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",
&[
"convert".as_ref(),
"-ping".as_ref(),
// "-ping".as_ref(), // re-enable -ping after imagemagick fix
input_file.as_os_str(),
"JSON:".as_ref(),
],
@ -197,7 +197,7 @@ where
timeout,
)?
.read()
.into_vec()
.into_string()
.await;
input_file.cleanup().await.map_err(MagickError::Cleanup)?;
@ -213,7 +213,7 @@ where
}
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)
}

View File

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