element-hq / element-hq/dendrite

Dendrite responds incorrectly to invalid media

Open
#1,994 1 comment 0 reactions 0 assignees View on GitHub
C-Media-API T-Defect
Dominant language
Go
Stars
965
Forks
101
PR merge metrics
No merged PRs in 30d

Description

*This issue was originally created by [**@ShadowJonathan**](https://github.com/ShadowJonathan) at .*

### Background information

- **Dendrite version or git SHA**: `221ed52`
- **Monolith or Polylith?**: Monolith
- **SQLite3 or Postgres?**: Postgres
- **Running in Docker?**: No
- **`go version`**: Go 1.17

Homeserver in question is `jp.cube64128.xyz`

These same symptoms are present on `dendrite.matrix.org`

### Description

Dendrite returns a confusing error message to non-existent media;

`{"errcode":"M_NOT_FOUND","error":"Failed to download: fileutils.GetPathFromBase64Hash: Invalid filePath (Base64Hash too short - min 3 characters): \"\""}`

[this MXC](https://jp.cube64128.xyz/_matrix/media/r0/download/matrix.org/DRevoaEiuzbkOznknySKuMmE) is valid, while [this one](https://jp.cube64128.xyz/_matrix/media/r0/download/matrix.org/DRevoaEiuzbkOznknySKuMmF) isn't, replacing the latter with `matrix.org` or any synapse server returns a proper message of "not found"

Contributor guide

Open the contributing guide

Research direction

Reproduce the two Matrix media download URLs in the issue and compare their responses with Dendrite and Synapse. Trace the media download handling from the reported endpoint; done means an invalid MXC returns a clear not-found response rather than the internal Base64Hash error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.