commit 5e37c4aebf3961f5f671b123b8318ce82646f370 parent 550226f212fe45c4f1029dff497b425469dde512 Author: Gavin Peacock <gpeacock@adobe.com> Date: Thu, 28 Mar 2024 20:06:58 -0700 remove file_io dependency on fetch_remote_manifests (#434) Diffstat:
| M | sdk/Cargo.toml | | | 2 | +- |
| M | sdk/src/store.rs | | | 28 | ++++++---------------------- |
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml @@ -32,7 +32,7 @@ file_io = ["openssl_sign"] serialize_thumbnails = [] xmp_write = ["xmp_toolkit"] no_interleaved_io = ["file_io"] -fetch_remote_manifests = ["file_io"] +fetch_remote_manifests = [] openssl_sign = ["openssl"] json_schema = ["dep:schemars"] pdf = ["dep:lopdf"] diff --git a/sdk/src/store.rs b/sdk/src/store.rs @@ -2681,7 +2681,7 @@ impl Store { } // fetch remote manifest if possible - #[cfg(feature = "file_io")] + #[cfg(feature = "fetch_remote_manifests")] fn fetch_remote_manifest(url: &str) -> Result<Vec<u8>> { use conv::ValueFrom; use ureq::Error as uError; @@ -2729,30 +2729,14 @@ impl Store { } /// Handles remote manifests when file_io/fetch_remote_manifests feature is enabled - #[cfg(feature = "file_io")] fn handle_remote_manifest(ext_ref: &str) -> Result<Vec<u8>> { // verify provenance path is remote url - let is_remote_url = Store::is_valid_remote_url(ext_ref); - - if cfg!(feature = "fetch_remote_manifests") && is_remote_url { - Store::fetch_remote_manifest(ext_ref) - } else { - // return an error with the url that should be read - if is_remote_url { - Err(Error::RemoteManifestUrl(ext_ref.to_owned())) - } else { - Err(Error::JumbfNotFound) + if Store::is_valid_remote_url(ext_ref) { + #[cfg(feature = "fetch_remote_manifests")] + { + Store::fetch_remote_manifest(ext_ref) } - } - } - - /// Handles remote manifests for Wasm or when the file_io/fetch_remote_manifests feature is disabled - #[cfg(not(feature = "file_io"))] - fn handle_remote_manifest(ext_ref: &str) -> Result<Vec<u8>> { - // verify provenance path is remote url - let is_remote_url = Store::is_valid_remote_url(ext_ref); - - if is_remote_url { + #[cfg(not(feature = "fetch_remote_manifests"))] Err(Error::RemoteManifestUrl(ext_ref.to_owned())) } else { Err(Error::JumbfNotFound)