Downloading or deleting a file that no longer exists answers 500 instead of 404 #162

Closed
opened 2026-10-08 18:36:27 -07:00 by rays · 1 comment
Owner

Found in a code audit on 2026-10-09.

POST /api/enclosures/{id}/download and DELETE /api/enclosures/{id} (src/web.rs:1731, src/web.rs:1761) answer a file id that does not exist with a 500, logged as an api error warning, because the missing row is raised with anyhow!, which ApiError turns into a server error. A page left open after a feed was forgotten asks for exactly that. It is the caller's mistake, a 404 like the other lookups, and as a 500 it turns up in the production check as a server error.

Found in a code audit on 2026-10-09. `POST /api/enclosures/{id}/download` and `DELETE /api/enclosures/{id}` (`src/web.rs:1731`, `src/web.rs:1761`) answer a file id that does not exist with a 500, logged as an `api error` warning, because the missing row is raised with `anyhow!`, which `ApiError` turns into a server error. A page left open after a feed was forgotten asks for exactly that. It is the caller's mistake, a 404 like the other lookups, and as a 500 it turns up in the production check as a server error.
rays added the bug label 2026-10-08 18:36:27 -07:00
Author
Owner

Fixed in 4db5ee5: both answer 404 "no file {id}". Deployed as 0.10.3-dev on 2026-10-09.

Fixed in 4db5ee5: both answer 404 "no file {id}". Deployed as 0.10.3-dev on 2026-10-09.
rays closed this issue 2026-10-08 18:58:48 -07:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rays/ipx#162