mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-30 22:43:10 +00:00
media: return application/octet-stream if no content-type was provided
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
b1886583d9
commit
1af65e695d
|
@ -62,13 +62,13 @@ pub fn content_disposition_type(buf: &[u8], content_type: &Option<String>) -> &'
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[tracing::instrument(skip(buf))]
|
#[tracing::instrument(skip(buf))]
|
||||||
pub fn make_content_type(buf: &[u8], content_type: &Option<String>) -> &'static str {
|
pub fn make_content_type(buf: &[u8], content_type: &Option<String>) -> &'static str {
|
||||||
let Some(file_type) = infer::get(buf) else {
|
let Some(claimed_content_type) = content_type else {
|
||||||
debug_info!("Failed to infer the file's contents");
|
|
||||||
return APPLICATION_OCTET_STREAM;
|
return APPLICATION_OCTET_STREAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(claimed_content_type) = content_type else {
|
let Some(file_type) = infer::get(buf) else {
|
||||||
return file_type.mime_type();
|
debug_info!("Failed to infer the file's contents");
|
||||||
|
return APPLICATION_OCTET_STREAM;
|
||||||
};
|
};
|
||||||
|
|
||||||
if claimed_content_type.contains("svg") && file_type.mime_type().contains("xml") {
|
if claimed_content_type.contains("svg") && file_type.mime_type().contains("xml") {
|
||||||
|
|
Loading…
Reference in a new issue