diff --git a/crates/core/src/fs/named_file.rs b/crates/core/src/fs/named_file.rs index 29ee2ddfb..1aa51f09f 100644 --- a/crates/core/src/fs/named_file.rs +++ b/crates/core/src/fs/named_file.rs @@ -229,11 +229,11 @@ fn build_content_disposition( .to_str() .map(|c| c.parse::().unwrap_or(mime::APPLICATION_OCTET_STREAM)) .unwrap_or(mime::APPLICATION_OCTET_STREAM); - match (content_type.type_(), content_type.subtype()) { - (mime::IMAGE | mime::TEXT | mime::VIDEO | mime::AUDIO, _) - | (_, mime::JAVASCRIPT | mime::JSON) => "inline", - _ => "attachment", - } + match (content_type.type_(), content_type.subtype()) { + (mime::IMAGE | mime::TEXT | mime::VIDEO | mime::AUDIO, _) + | (_, mime::JAVASCRIPT | mime::JSON) => "inline", + _ => "attachment", + } } }); let content_disposition = if disposition_type == "attachment" { diff --git a/crates/serve-static/src/dir.rs b/crates/serve-static/src/dir.rs index 01f3b21ee..1dfbe5f69 100644 --- a/crates/serve-static/src/dir.rs +++ b/crates/serve-static/src/dir.rs @@ -435,7 +435,10 @@ impl Handler for StaticDir { let builder = { let mut builder = NamedFile::builder(named_path).content_type( mime_infer::from_ext(ext.as_deref().unwrap_or_default()) - .first_or_octet_stream().as_ref().parse::().unwrap_or(APPLICATION_OCTET_STREAM), + .first_or_octet_stream() + .as_ref() + .parse::() + .unwrap_or(APPLICATION_OCTET_STREAM), ); if let Some(content_encoding) = content_encoding { builder = builder.content_encoding(content_encoding);