element-hq / element-hq/element-web

Service Worker (`sw.js`) is not working correctly for Firefox Browser -> Cannot view authenticated Media anymore

Open
#28,370 22 comments 6 reactions 0 assignees View on GitHub
A-Media O-Uncommon S-Major T-Defect X-Cannot-Reproduce
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Use Firefox Browser (or Firefox based like Tor)
2. Use any up-to-date Element instance. e.g. https://app.element.io
3. Log into a Homeserver with [authenticated media](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html?highlight=enable_authenticated_media#enable_authenticated_media) enabled.
4. Now Pictures wont load with a very high chance and Videos basically never work.

### Outcome

#### What did you expect?
To view the Media, e.g. the picture or video

#### What happened instead?

A 404 request got returned because the old `/_matrix/media/v3/download` URL got called by element web, instead of the new `/_matrix/client/v1/media/download` URL

![image](https://github.com/user-attachments/assets/f787b452-bfa0-4bf7-a0e6-216704918920)

```
# Element web request

2024-11-02 10:30:08,471 - synapse.access.http.8008 - 428 - DEBUG - GET-4928 - 192.168.178.1 - 8008 - Received request: GET /_matrix/media/v3/download/jameskitt616.one/wfDMUEttAKzpoDtwESGuIMgy?allow_redirect=true
2024-11-02 10:30:08,473 - synapse.http.server - 130 - INFO - GET-4928 - SynapseError: 404 - Not found
2024-11-02 10:30:08,473 - synapse.access.http.8008 - 473 - INFO - GET-4928 - 192.168.178.1 - 8008 - {None} Processed request: 0.002sec/0.000sec (0.001sec, 0.000sec) (0.000sec/0.001sec/1) 45B 404 "GET /_matrix/media/v3/download/jameskitt616.one/wfDMUEttAKzpoDtwESGuIMgy?allow_redirect=true HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0" [0 dbevts]

# Cinny web request

2024-11-02 10:30:16,844 - synapse.access.http.8008 - 428 - DEBUG - OPTIONS-5043 - 192.168.178.1 - 8008 - Received request: OPTIONS /_matrix/client/v1/media/download/jameskitt616.one/wfDMUEttAKzpoDtwESGuIMgy?allow_redirect=true
2024-11-02 10:30:16,844 - synapse.access.http.8008 - 473 - DEBUG - OPTIONS-5043 - 192.168.178.1 - 8008 - {None} Processed request: 0.000sec/-0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 0B 204 "OPTIONS /_matrix/client/v1/media/download/jameskitt616.one/wfDMUEttAKzpoDtwESGuIMgy?allow_redirect=true HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36" [0 dbevts]
```

### Operating system

Linux Fedora 41

### Browser information

Firefox 132.0

### URL for webapp

https://app.element.io/, https://element.jameskitt616.one/

### Application version

jameskitt616 version: 1.11.83 Crypto version: Rust SDK 0.7.2 (7a21514), Vodozemac 0.7.0;;;;;;;Element version: 1.11.83 Crypto version: Rust SDK 0.7.2 (7a21514), Vodozemac 0.7.0

### Homeserver

matrix.jameskitt616.one Synapse 1.118.0

### Will you send logs?

No

Contributor guide

Open the contributing guide

Research direction

Start with sw.js and reproduce the authenticated-media request in Firefox using the Element web instance described. Compare the old /_matrix/media/v3/download path with the /_matrix/client/v1/media/download path shown in the report. Done means authenticated pictures and videos load in Firefox without the 404 request.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.