Repository navigation
TIKA-5032: Emit the stored preview of zip-based formats as THUMBNAIL - #3530
Merged
Merged
Conversation
dschmidt
marked this pull request as ready for review
November 4, 2026 16:25
This was referenced Nov 4, 2026
# Conflicts: # CHANGES.txt
Contributor
Author
|
@tballison jfyi: from all the PRs I've sent today, this kinda has the highest priority for me - I need it as a prerequisite for one or two followups :) |
Contributor
|
merge upstream and a small tweak. lemme know if you have objections. |
Contributor
Author
|
No, of course not, looks reasonable :) |
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.
Several zip-based formats carry a ready-made preview image, but Tika either has no type for them or only sees a plain zip, so
/unpack/preset/thumbnailhas nothing to serve.ZipParser now asks a small
ZipPreviewtable which entry is the preview for the container's type and marks that entry asTHUMBNAIL:.cbzapplication/vnd.comicbook+zip__MACOSX/and hidden files skipped).kraapplication/x-kritapreview.png.oraimage/openrasterThumbnails/thumbnail.png.FCStdapplication/x-extension-fcstdthumbnails/Thumbnail.png.procreateapplication/x-procreateQuickLook/Thumbnail.png.sketch(43 and later)application/x-sketchpreviews/preview.pngAll six are sub-types of
application/zipand are added to ZipParser's zip specializations so the type is kept. Krita and OpenRaster are already identified by theirmimetypeentry through OpenDocumentDetector; the others by extension. Because the types are zip sub-types, a file with a colliding extension that is not a zip keeps its detected type: an Oracletnsnames.orastays text, a pre-43 Sketch file staysapplication/x-sqlite3. The preview is only picked on theZipFilepath: the comic rule needs the whole central directory.Tests build their zips at runtime (no binary fixtures): the cover is picked by name regardless of archive order, macOS leftovers and
ComicInfo.xmlare ignored, each fixed path is marked, a missing preview marks nothing, and a plain.zipgets no thumbnail. Also checked by hand against one real file of each format: the preset returned exactly the stored preview for all six, and 204 before.Follow-up once this and #3529 are merged: the 3MF thumbnail. It should follow the package's thumbnail relationship in
_rels/.rels(http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail), as 3MF is an OPC package, rather than assume the usual/Metadata/thumbnail.png.https://issues.apache.org/jira/browse/TIKA-5032