From fc00b96d8bbe4c5d44a0808478d0807e7e5dd4f7 Mon Sep 17 00:00:00 2001 From: Ben Botwin Date: Mon, 16 Feb 2026 17:39:15 -0500 Subject: [PATCH] Added proper 404 for not found media and fixed devshell for running tests --- src/api/client/media.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api/client/media.rs b/src/api/client/media.rs index ce5b9ac0..7ae22a27 100644 --- a/src/api/client/media.rs +++ b/src/api/client/media.rs @@ -145,11 +145,13 @@ pub(crate) async fn get_content_route( media_id: &body.media_id, }; - let FileMeta { + let Ok(FileMeta { content, content_type, content_disposition, - } = fetch_file(&services, &mxc, user, body.timeout_ms, None).await?; + }) = fetch_file(&services, &mxc, user, body.timeout_ms, None).await else { + return Err!(Request(NotFound("Media not found."))); + }; Ok(get_content::v1::Response { file: content.expect("entire file contents"), @@ -181,11 +183,13 @@ pub(crate) async fn get_content_as_filename_route( media_id: &body.media_id, }; - let FileMeta { + let Ok(FileMeta { content, content_type, content_disposition, - } = fetch_file(&services, &mxc, user, body.timeout_ms, Some(&body.filename)).await?; + }) = fetch_file(&services, &mxc, user, body.timeout_ms, None).await else { + return Err!(Request(NotFound("Media not found."))); + }; Ok(get_content_as_filename::v1::Response { file: content.expect("entire file contents"),