ran format
This commit is contained in:
parent
18c4be869f
commit
50fa8c3abf
1 changed files with 18 additions and 12 deletions
|
|
@ -149,7 +149,8 @@ pub(crate) async fn get_content_route(
|
||||||
content,
|
content,
|
||||||
content_type,
|
content_type,
|
||||||
content_disposition,
|
content_disposition,
|
||||||
}) = fetch_file(&services, &mxc, user, body.timeout_ms, None).await else {
|
}) = fetch_file(&services, &mxc, user, body.timeout_ms, None).await
|
||||||
|
else {
|
||||||
return Err!(Request(NotFound("Media not found.")));
|
return Err!(Request(NotFound("Media not found.")));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -188,22 +189,27 @@ pub(crate) async fn get_content_as_filename_route(
|
||||||
content_type,
|
content_type,
|
||||||
content_disposition,
|
content_disposition,
|
||||||
} = match fetch_file(&services, &mxc, user, body.timeout_ms, None).await {
|
} = match fetch_file(&services, &mxc, user, body.timeout_ms, None).await {
|
||||||
Ok(meta) => meta,
|
| Ok(meta) => meta,
|
||||||
Err(e) => {
|
| Err(e) => {
|
||||||
match e {
|
match e {
|
||||||
conduwuit::Error::Io(e) => {
|
| conduwuit::Error::Io(e) => {
|
||||||
match e.kind() {
|
match e.kind() {
|
||||||
std::io::ErrorKind::PermissionDenied =>
|
| std::io::ErrorKind::PermissionDenied =>
|
||||||
// to not leak that a file exists
|
// to not leak that a file exists
|
||||||
return Err!(Request(NotFound("Media not found."))),
|
{
|
||||||
std::io::ErrorKind::NotFound =>
|
return Err!(Request(NotFound("Media not found.")));
|
||||||
return Err!(Request(NotFound("Media not found."))),
|
},
|
||||||
_ => return Err!(Request(Unknown("Unknown error when fetching file."))),
|
| std::io::ErrorKind::NotFound => {
|
||||||
|
return Err!(Request(NotFound("Media not found.")));
|
||||||
|
},
|
||||||
|
| _ => {
|
||||||
|
return Err!(Request(Unknown("Unknown error when fetching file.")));
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => return Err!(Request(Unknown("Unknown error when fetching file."))),
|
| _ => return Err!(Request(Unknown("Unknown error when fetching file."))),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(get_content_as_filename::v1::Response {
|
Ok(get_content_as_filename::v1::Response {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue