element-hq / element-hq/hydrogen-web

File downloading won't work in embedded mode

Open
#795 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
714
Forks
131
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
File downloading won't work in embedded mode

**To Reproduce**
Steps to reproduce the behavior:
1. Build project using Vite in Library Mode. In that case assets including [download-sandbox.html](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/assets/download-sandbox.html) embed into final js.
2. Include final js-file in you project.
3. Run app.
4. Try to download file in the chat room.

**Additional context**
The problem is in the [download-sandbox.html](https://github.com/vector-im/hydrogen-web/blob/master/src/platform/web/assets/download-sandbox.html) line 36. Because in embedded mode _window.location.origin_ of iframe element is null. So the expression _event.origin === window.location.origin_ is always false.

Contributor guide

Open the contributing guide

Research direction

Start with src/platform/web/assets/download-sandbox.html, especially line 36, and reproduce the issue by building the project with Vite in Library Mode. Check the embedded iframe origin handling and verify that downloading a file from a chat room succeeds when the generated JavaScript is included in another project.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
frontend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.