-
Notifications
You must be signed in to change notification settings - Fork 0
ETT-571: handle empty DateTime in RGB TIFFs #167
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
Conversation
"copy_old_to_new" was checking that the field existed previously, but not that it was non-empty. This doesn't cover every possible scenario, and there are likely other cases of invalid metadata in RGB TIFFs that we may need to handle in the future, but we can deal with it when it comes up.
| ok($validate->succeeded()); | ||
| }; | ||
|
|
||
| it "remediates empty DateTime in a bitonal TIFF file" => sub { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test (with its associated fixture) passed without any changes to the ImageRemediate code, but I think it's worth keeping as a regression test.
| defined $self->{oldFields}->{$oldFieldName} and | ||
| not defined $self->{newFields}->{$newFieldName} | ||
| defined $self->{oldFields}->{$oldFieldName} | ||
| and $self->{oldFields}->{$oldFieldName} ne '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method (copy_old_to_new) is called here:
feed/lib/HTFeed/Stage/ImageRemediate.pm
Line 1165 in 6b1f116
| $self->copy_old_to_new("IFD0:ModifyDate", "XMP-tiff:DateTime"); |
copy_old_to_new but I don't know if we've run into that exactly.
liseli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good. I appreciate seeing the different tests that consider various scenarios for image validation.
This ended up being a bit tricky to track down because the error didn't give a useful stack trace, and the culprit is buried in the rather long
convert_tiff_to_jpeg2000method.This was indeed a one-line fix (6b1f116#diff-0d491008f8069f2e647a11563976e76d9a8fd71e522c3efbb3b9384b58b93ae6R175), but getting there was a bit tricky in terms of figuring out exactly what triggered the issue, creating a test fixture, and then actually finding the source of the problem.
It may be worth thinking a bit about what we do with ImageRemediate in the future – in particular if we want to make major changes to this in the future we should do some refactoring and unit testing there first.
6b1f116 is the commit with the actual changes. Some comments inline.