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

This commit is contained in:
kdeng00
2025-10-31 12:07:01 -04:00
parent ca38465f2d
commit f6f2282bd1
+2 -1
View File
@@ -318,11 +318,12 @@ pub mod endpoint {
) -> (axum::http::StatusCode, axum::response::Response) { ) -> (axum::http::StatusCode, axum::response::Response) {
match repo::coverart::get_coverart_queue_data_with_id(&pool, &id).await { match repo::coverart::get_coverart_queue_data_with_id(&pool, &id).await {
Ok(data) => { Ok(data) => {
let file_type = icarus_meta::detection::coverart::file_type_from_data(&data).unwrap();
let bytes = axum::body::Bytes::from(data); let bytes = axum::body::Bytes::from(data);
let mut response = bytes.into_response(); let mut response = bytes.into_response();
let headers = response.headers_mut(); let headers = response.headers_mut();
// TODO: Address this hard coding for the coverart content type // 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 // TODO: Make the conent disposition more dynamic
headers.insert( headers.insert(
axum::http::header::CONTENT_DISPOSITION, axum::http::header::CONTENT_DISPOSITION,