c2pa-rs

A fork of https://github.com/contentauth/c2pa-rs/
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/c2pa-rs.git
Log | Files | Refs | README

commit 0b9faad864034058125add4f8e7cd14ea1222673
parent 42cb1c059773e6bc71d829f68767df7132d66fe7
Author: mauricefisher64 <92736594+mauricefisher64@users.noreply.github.com>
Date:   Tue,  8 Nov 2022 17:39:46 -0500

Fix bad error response when manifest is stripped (#153)

* Fix bad error response when manifest is stripped

* Format fixes

* Change to address PR comments

* test file
Diffstat:
Msdk/src/store.rs | 20+++++++++++++++++++-
Asdk/tests/fixtures/no_manifest.jpg | 0
2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/sdk/src/store.rs b/sdk/src/store.rs @@ -1895,7 +1895,11 @@ impl Store { Store::fetch_remote_manifest(&ext_ref) } else { // return an error with the url that should be read - Err(Error::RemoteManifestUrl(ext_ref)) + if is_remote_url { + Err(Error::RemoteManifestUrl(ext_ref)) + } else { + Err(Error::JumbfNotFound) + } } } else { Err(Error::JumbfNotFound) @@ -2907,6 +2911,20 @@ pub mod tests { } #[test] + #[cfg(all(feature = "file_io"))] + fn test_removed_jumbf() { + // test adding to actual image + let ap = fixture_path("no_manifest.jpg"); + + let mut report = DetailedStatusTracker::new(); + + // can we read back in + let _store = Store::load_from_asset(&ap, true, &mut report); + + assert!(report_has_err(report.get_log(), Error::JumbfNotFound)); + } + + #[test] fn test_external_manifest_sidecar() { // test adding to actual image let ap = fixture_path("libpng-test.png"); diff --git a/sdk/tests/fixtures/no_manifest.jpg b/sdk/tests/fixtures/no_manifest.jpg Binary files differ.