mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-05-29 16:44:02 +00:00
Added proper 404 for not found media and fixed devshell for running tests
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user