tsk-200: Utilizing mime for Content type for fetching queued CoverArt data (#233)

* tsk-200: Utilizing mime for Content type for fetching queued CoverArt data

* tsk-200: Cleanup

* tsk-200: Version bump
This commit was merged in pull request #233.
This commit is contained in:
KD
2025-10-31 12:20:11 -04:00
committed by GitHub
parent ca38465f2d
commit c630cb84b5
3 changed files with 8 additions and 4 deletions
Generated
+1 -1
View File
@@ -964,7 +964,7 @@ dependencies = [
[[package]]
name = "icarus"
version = "0.3.15"
version = "0.3.16"
dependencies = [
"axum",
"axum-extra",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "icarus"
version = "0.3.15"
version = "0.3.16"
edition = "2024"
rust-version = "1.90"
+6 -2
View File
@@ -318,11 +318,15 @@ pub mod endpoint {
) -> (axum::http::StatusCode, axum::response::Response) {
match repo::coverart::get_coverart_queue_data_with_id(&pool, &id).await {
Ok(data) => {
let file_type =
icarus_meta::detection::coverart::file_type_from_data(&data).unwrap();
let bytes = axum::body::Bytes::from(data);
let mut response = bytes.into_response();
let headers = response.headers_mut();
// TODO: Address this hard coding for the coverart content type
headers.insert(axum::http::header::CONTENT_TYPE, "image".parse().unwrap());
headers.insert(
axum::http::header::CONTENT_TYPE,
file_type.mime.parse().unwrap(),
);
// TODO: Make the conent disposition more dynamic
headers.insert(
axum::http::header::CONTENT_DISPOSITION,