tsk-201: Making content disposition more unique #234
Generated
+1
-1
@@ -964,7 +964,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.16"
|
version = "0.3.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"axum-extra",
|
"axum-extra",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "icarus"
|
name = "icarus"
|
||||||
version = "0.3.16"
|
version = "0.3.17"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.90"
|
rust-version = "1.90"
|
||||||
|
|
||||||
|
|||||||
@@ -327,10 +327,30 @@ pub mod endpoint {
|
|||||||
axum::http::header::CONTENT_TYPE,
|
axum::http::header::CONTENT_TYPE,
|
||||||
file_type.mime.parse().unwrap(),
|
file_type.mime.parse().unwrap(),
|
||||||
);
|
);
|
||||||
// TODO: Make the conent disposition more dynamic
|
|
||||||
|
let coverart_type = if file_type.file_type
|
||||||
|
== icarus_meta::detection::coverart::constants::JPEG_TYPE
|
||||||
|
{
|
||||||
|
icarus_models::types::CoverArtType::JpegExtension
|
||||||
|
} else if file_type.file_type
|
||||||
|
== icarus_meta::detection::coverart::constants::JPG_TYPE
|
||||||
|
{
|
||||||
|
icarus_models::types::CoverArtType::JpgExtension
|
||||||
|
} else if file_type.file_type
|
||||||
|
== icarus_meta::detection::coverart::constants::PNG_TYPE
|
||||||
|
{
|
||||||
|
icarus_models::types::CoverArtType::PngExtension
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::response::Response::default(),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
let filename =
|
||||||
|
icarus_models::coverart::generate_filename(coverart_type, true).unwrap();
|
||||||
headers.insert(
|
headers.insert(
|
||||||
axum::http::header::CONTENT_DISPOSITION,
|
axum::http::header::CONTENT_DISPOSITION,
|
||||||
format!("attachment; filename=\"{id}.jpg\"")
|
format!("attachment; filename=\"{filename}\"")
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user