From 6f99ac2160f6d1ea8596a04ab9a4b1b3e8524692 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Mon, 28 Oct 2024 15:38:07 +0000 Subject: [PATCH] chore: bump little_exif debug code --- crates/services/autumn/Cargo.toml | 2 +- crates/services/autumn/src/exif.rs | 35 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/crates/services/autumn/Cargo.toml b/crates/services/autumn/Cargo.toml index f1093177..e571ab74 100644 --- a/crates/services/autumn/Cargo.toml +++ b/crates/services/autumn/Cargo.toml @@ -13,7 +13,7 @@ webp = "0.3.0" sha2 = "0.10.8" jxl-oxide = "0.8.1" kamadak-exif = "0.5.4" -# revolt_little_exif = "0.4.0" +# revolt_little_exif = "0.5.1" image = { version = "0.25.2" } # avif encode requires dav1d system library: features = ["avif-native"] # File processing diff --git a/crates/services/autumn/src/exif.rs b/crates/services/autumn/src/exif.rs index 0220f73b..23be9ac7 100644 --- a/crates/services/autumn/src/exif.rs +++ b/crates/services/autumn/src/exif.rs @@ -17,23 +17,24 @@ pub async fn strip_metadata( ) -> Result<(Vec, Metadata)> { match &metadata { Metadata::Image { width, height } => match mime { - // little_exif does not appear to parse JPEGs correctly? had 2/2 files fail - /* "image/jpeg" | "image/png" => { - // use little_exif to strip metadata except for orientation and colour profile - // PNGs must also be re-encoded to mitigate CVE-2023-21036 - let metadata = revolt_little_exif::metadata::Metadata::new_from_path_with_filetype( - file.path(), - match mime { - "image/jpeg" => revolt_little_exif::filetype::FileExtension::JPEG, - "image/png" => revolt_little_exif::filetype::FileExtension::PNG { - as_zTXt_chunk: true, - }, - _ => unreachable!(), - }, - ) - .unwrap(); - dbg!(metadata.data()); - } */ + // // little_exif does not appear to parse JPEGs correctly? had 2/2 files fail + // "image/jpeg" | "image/png" => { + // // use little_exif to strip metadata except for orientation and colour profile + // // PNGs must also be re-encoded to mitigate CVE-2023-21036 + // let metadata = revolt_little_exif::metadata::Metadata::new_from_path_with_filetype( + // file.path(), + // match mime { + // "image/jpeg" => revolt_little_exif::filetype::FileExtension::JPEG, + // "image/png" => revolt_little_exif::filetype::FileExtension::PNG { + // as_zTXt_chunk: true, + // }, + // _ => unreachable!(), + // }, + // ) + // .unwrap(); + // dbg!(metadata.data()); + // todo!() + // } // Apply orientation manually & strip all other EXIF data "image/jpeg" | "image/png" | "image/avif" | "image/tiff" => { // Create a reader