Don't -ping when extracting file details (workaround for imagemagick json bug)

This commit is contained in:
asonix 2023-12-23 12:48:32 -06:00
parent df8fc00ad5
commit c2e53766c2
2 changed files with 6 additions and 6 deletions

View File

@ -189,7 +189,7 @@ where
"magick", "magick",
&[ &[
"convert".as_ref(), "convert".as_ref(),
"-ping".as_ref(), // "-ping".as_ref(), // re-enable -ping after imagemagick fix
input_file.as_os_str(), input_file.as_os_str(),
"JSON:".as_ref(), "JSON:".as_ref(),
], ],
@ -197,7 +197,7 @@ where
timeout, timeout,
)? )?
.read() .read()
.into_vec() .into_string()
.await; .await;
input_file.cleanup().await.map_err(MagickError::Cleanup)?; input_file.cleanup().await.map_err(MagickError::Cleanup)?;
@ -213,7 +213,7 @@ where
} }
let output: Vec<MagickDiscovery> = let output: Vec<MagickDiscovery> =
serde_json::from_slice(&output).map_err(MagickError::Json)?; serde_json::from_str(&output).map_err(|e| MagickError::Json(output, e))?;
parse_discovery(output).map_err(MagickError::Discover) parse_discovery(output).map_err(MagickError::Discover)
} }

View File

@ -17,8 +17,8 @@ pub(crate) enum MagickError {
#[error("Error in imagemagick process")] #[error("Error in imagemagick process")]
Process(#[source] ProcessError), Process(#[source] ProcessError),
#[error("Invalid output format")] #[error("Invalid output format: {0}")]
Json(#[source] serde_json::Error), Json(String, #[source] serde_json::Error),
#[error("Error writing bytes")] #[error("Error writing bytes")]
Write(#[source] std::io::Error), Write(#[source] std::io::Error),
@ -62,7 +62,7 @@ impl MagickError {
match self { match self {
Self::CommandFailed(_) => ErrorCode::COMMAND_FAILURE, Self::CommandFailed(_) => ErrorCode::COMMAND_FAILURE,
Self::Process(e) => e.error_code(), Self::Process(e) => e.error_code(),
Self::Json(_) Self::Json(_, _)
| Self::Write(_) | Self::Write(_)
| Self::CreateFile(_) | Self::CreateFile(_)
| Self::CreateDir(_) | Self::CreateDir(_)