2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +00:00

Fix content type on already processed images

This commit is contained in:
asonix 2022-06-21 11:27:22 -05:00
parent c9e4e3b8f5
commit cb9a594f24

View file

@ -47,6 +47,8 @@ mod stream;
mod tmp_file; mod tmp_file;
mod validate; mod validate;
use crate::magick::ValidInputType;
use self::{ use self::{
backgrounded::Backgrounded, backgrounded::Backgrounded,
config::{Configuration, ImageFormat, Operation}, config::{Configuration, ImageFormat, Operation},
@ -419,7 +421,24 @@ async fn process<R: FullRepo, S: Store + 'static>(
.await?; .await?;
if let Some(identifier) = identifier_opt { if let Some(identifier) = identifier_opt {
let details = ensure_details(&**repo, &**store, &alias).await?; let details = repo.details(&identifier).await?;
let details = if let Some(details) = details {
debug!("details exist");
details
} else {
debug!("generating new details from {:?}", identifier);
let new_details = Details::from_store(
(**store).clone(),
identifier.clone(),
Some(ValidInputType::from_format(format)),
)
.await?;
debug!("storing details for {:?}", identifier);
repo.relate_details(&identifier, &new_details).await?;
debug!("stored");
new_details
};
return ranged_file_resp(&**store, identifier, range, details).await; return ranged_file_resp(&**store, identifier, range, details).await;
} }