chore: bump little_exif debug code

This commit is contained in:
Paul Makles
2024-10-28 15:38:07 +00:00
parent 2fcc714546
commit 6f99ac2160
2 changed files with 19 additions and 18 deletions

View File

@@ -13,7 +13,7 @@ webp = "0.3.0"
sha2 = "0.10.8" sha2 = "0.10.8"
jxl-oxide = "0.8.1" jxl-oxide = "0.8.1"
kamadak-exif = "0.5.4" 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"] image = { version = "0.25.2" } # avif encode requires dav1d system library: features = ["avif-native"]
# File processing # File processing

View File

@@ -17,23 +17,24 @@ pub async fn strip_metadata(
) -> Result<(Vec<u8>, Metadata)> { ) -> Result<(Vec<u8>, Metadata)> {
match &metadata { match &metadata {
Metadata::Image { width, height } => match mime { Metadata::Image { width, height } => match mime {
// little_exif does not appear to parse JPEGs correctly? had 2/2 files fail // // little_exif does not appear to parse JPEGs correctly? had 2/2 files fail
/* "image/jpeg" | "image/png" => { // "image/jpeg" | "image/png" => {
// use little_exif to strip metadata except for orientation and colour profile // // use little_exif to strip metadata except for orientation and colour profile
// PNGs must also be re-encoded to mitigate CVE-2023-21036 // // PNGs must also be re-encoded to mitigate CVE-2023-21036
let metadata = revolt_little_exif::metadata::Metadata::new_from_path_with_filetype( // let metadata = revolt_little_exif::metadata::Metadata::new_from_path_with_filetype(
file.path(), // file.path(),
match mime { // match mime {
"image/jpeg" => revolt_little_exif::filetype::FileExtension::JPEG, // "image/jpeg" => revolt_little_exif::filetype::FileExtension::JPEG,
"image/png" => revolt_little_exif::filetype::FileExtension::PNG { // "image/png" => revolt_little_exif::filetype::FileExtension::PNG {
as_zTXt_chunk: true, // as_zTXt_chunk: true,
}, // },
_ => unreachable!(), // _ => unreachable!(),
}, // },
) // )
.unwrap(); // .unwrap();
dbg!(metadata.data()); // dbg!(metadata.data());
} */ // todo!()
// }
// Apply orientation manually & strip all other EXIF data // Apply orientation manually & strip all other EXIF data
"image/jpeg" | "image/png" | "image/avif" | "image/tiff" => { "image/jpeg" | "image/png" | "image/avif" | "image/tiff" => {
// Create a reader // Create a reader