Skip to content

Commit 5c2039e

Browse files
authored
TIKA-4776: Add regression test for Apple maker note LONG8 tags (#2981)
* [TIKA-4776] Add regression test for Apple maker note LONG8 tags metadata-extractor 2.21.0 (already bumped on main) decodes the LONG8 and SLONG8 TIFF format codes, so the Apple maker note tags written as LONG8 reach Tika now. The fixture is the still half of a real Apple Live Photo (iPhone 15 Pro, iOS 18.5) from the MIT licensed osxphotos test suite; the test pins the content identifier and the Live Photo ID (maker note tag 0x0017), which was dropped with metadata-extractor 2.20.0. * [TIKA-4776] Shrink the fixture to the real EXIF payload Replace the full 1379953 byte iPhone photo with a 3203 byte HEIC that repackages the unmodified EXIF item (including the Apple maker note with the LONG8 tag 0x0017) into a minimal container. The picture item data is replaced by filler bytes; the asserted values still come from the original EXIF bytes.
1 parent b2f69cc commit 5c2039e

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-image-module/src/test/java/org/apache/tika/parser/image/HeifParserTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,30 @@ public void testSimple() throws Exception {
5757
}
5858
}
5959

60+
/*
61+
testHEIC_livePhoto.heic carries the unmodified EXIF payload (including
62+
the Apple maker note) of the still half of an Apple Live Photo
63+
(iPhone 15 Pro, iOS 18.5), retrieved from the MIT licensed osxphotos
64+
test suite:
65+
https://github.com/RhetTbull/osxphotos/tree/main/tests/Test-Live-15.7.2.photoslibrary
66+
The EXIF item was repackaged into a minimal HEIC container (the
67+
picture item data is replaced by filler bytes) to keep the fixture
68+
small.
69+
*/
70+
@Test
71+
public void testAppleLivePhotoMakerNote() throws Exception {
72+
//the content identifier pairs the still with its video half; the
73+
//Live Photo ID (Apple maker note tag 0x0017) is written as LONG8 and
74+
//was dropped before metadata-extractor 2.21.0. TIKA-4776
75+
Metadata metadata = new Metadata();
76+
try (TikaInputStream tis = getResourceAsStream("/test-documents/testHEIC_livePhoto.heic")) {
77+
parser.parse(tis, new DefaultHandler(), metadata, new ParseContext());
78+
79+
assertEquals("CD28D161-D5EC-4CDE-8B60-DACCC1363B6B",
80+
metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Content Identifier"));
81+
assertEquals("5283876",
82+
metadata.get(ImageMetadataExtractor.UNKNOWN_IMG_NS + "Live Photo ID"));
83+
}
84+
}
85+
6086
}

0 commit comments

Comments
 (0)