Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove writing of native camera RAW formats from SDK #814

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sdk/src/asset_handlers/tiff_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ static SUPPORTED_TYPES: [&str; 10] = [
"image/x-nikon-nef",
];

// Writing native formats is beyond the scope of the SDK.
static SUPPORTED_WRITER_TYPES: [&str; 6] = [
"tif",
"tiff",
"image/tiff",
"dng",
"image/dng",
"image/x-adobe-dng",
];

// The type of an IFD entry
#[derive(Debug, PartialEq)]
enum IFDEntryType {
Expand Down Expand Up @@ -1414,7 +1424,11 @@ impl AssetIO for TiffIO {
}

fn get_writer(&self, asset_type: &str) -> Option<Box<dyn CAIWriter>> {
Some(Box::new(TiffIO::new(asset_type)))
if SUPPORTED_WRITER_TYPES.contains(&asset_type) {
Some(Box::new(TiffIO::new(asset_type)))
} else {
None
}
}

fn remote_ref_writer_ref(&self) -> Option<&dyn RemoteRefEmbed> {
Expand Down
4 changes: 4 additions & 0 deletions sdk/src/jumbf_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ pub mod tests {
assert!(get_caiwriter_handler(supported_type).is_some());
}
}

cdmurph32 marked this conversation as resolved.
Show resolved Hide resolved
// Writing native formats is beyond the scope of the SDK.
assert!(get_caiwriter_handler("nef").is_none());
assert!(get_caiwriter_handler("arw").is_none());
}

#[test]
Expand Down
Loading