Print nested XMP properties through their own print function - #9489
Open
jadhavgaurav wants to merge 1 commit into
Open
Print nested XMP properties through their own print function#9489jadhavgaurav wants to merge 1 commit into
jadhavgaurav wants to merge 1 commit into
Conversation
XmpProperties::printProperty() looked the print function up by the full key of the property. A nested property is keyed by its path, for example Xmp.plus.Licensor[1]/plus:LicensorTelephoneType1, so the lookup never matched and the raw value was printed. For the two PLUS licensor telephone types that means the controlled vocabulary URL was shown instead of the translated label. Fall back to the key of the innermost path element, which is the same element XmpProperties::propertyInfo() already resolves a nested key to. Fixes Exiv2#3332
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
exiv2 -pxprints the raw value of a nested XMP property even when that property has a print function registered.The report is about the two PLUS licensor telephone types, which are the only PLUS fields that are both subfields of a structure and use a controlled vocabulary:
Cause
XmpProperties::printPropertyUnlocked()looks the print function up inxmpPrintInfoby the full key. A nested property is keyed by its path (Xmp.plus.Licensor[1]/plus:LicensorTelephoneType1), and the table holds plain property keys (Xmp.plus.LicensorTelephoneType1), so the lookup never matches andprintValueis used. Top level PLUS fields such asXmp.plus.ModelReleaseStatusare unaffected and already print translated.Fix
If the direct lookup fails and the key is a path, retry with the key of the innermost path element. That is the same element
XmpProperties::propertyInfoUnlocked()already resolves a nested key to when it looks up the property definition, so the print function and the property definition now agree on which element a nested key describes.After the change:
Tests
New system test
tests/bugfixes/github/test_issue_3332.py, using the existing sampletest/data/issue_1959_poc.xmp, which already carries both values. It fails before the change and passes after (verified by reverting the source change, rebuilding and re-running).One reference file changes, and the change is the fix itself:
test/data/test_reference_files/issue_1959_poc.xmp.outlines 198 and 199 now showWorkandCellin the interpreted column. No other reference output in the tree changes, so no other nested key currently resolves to a property that has a print function.Local results:
unit_tests370/370,bugfixes325 pass and 10 skipped,regression_tests329 pass,tiff_test1 pass,bash_tests66/67 andlens_tests1/2. The two failures (io_test,test_canon_lenses) reproduce identically on unmodifiedmainin this build, which has network support off.clang-formatis not installed here, so the new code was hand matched to the surrounding style rather than tool checked.Fixes #3332