diff --git a/CHANGELOG.md b/CHANGELOG.md index ad7f1e4..70ab118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Downloading or deleting a file the server no longer has answers "not found" instead of a server error. - A feed's page in the Directory, and subscribing from it, no longer wait while the whole Directory is put together to check that the one feed is in it. - The feed list, and each live update of it, no longer asks the database for a group's title once for every feed in the group. - An episode that came as a torrent of several files plays its largest file, and can be deleted, by hand or to free space, instead of staying on disk for good. diff --git a/src/web.rs b/src/web.rs index 94cbaf0..c7f5d7d 100644 --- a/src/web.rs +++ b/src/web.rs @@ -1718,7 +1718,7 @@ async fn download_now( .ctx .db .enclosure(id).await? - .ok_or_else(|| anyhow::anyhow!("no enclosure {id}"))?; + .ok_or_else(|| ApiError::not_found(format!("no file {id}")))?; subscribed(&state, &user, &enc.feed_id).await?; if enc.path.is_some() { return Ok(StatusCode::NO_CONTENT); // Already here. @@ -1748,7 +1748,7 @@ async fn delete_file( .ctx .db .enclosure(id).await? - .ok_or_else(|| anyhow::anyhow!("no enclosure {id}"))?; + .ok_or_else(|| ApiError::not_found(format!("no file {id}")))?; subscribed(&state, &user, &enc.feed_id).await?; // There is one copy of the file: deleting it deletes everyone's. Say so before doing