dschmidt opened a new pull request, #3530:
URL: https://github.com/apache/tika/pull/3530

   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/thumbnail` 
has nothing to serve.
   
   ZipParser now asks a small `ZipPreview` table which entry is the preview for 
the container's type and marks that entry as `THUMBNAIL`:
   
   | Format | Type (new) | Preview |
   |---|---|---|
   | Comic book archive `.cbz` | `application/vnd.comicbook+zip` | first image 
in name order (`__MACOSX/` and hidden files skipped) |
   | Krita `.kra` | `application/x-krita` | `preview.png` |
   | OpenRaster `.ora` | `image/openraster` | `Thumbnails/thumbnail.png` |
   | FreeCAD `.FCStd` | `application/x-extension-fcstd` | 
`thumbnails/Thumbnail.png` |
   | Procreate `.procreate` | `application/x-procreate` | 
`QuickLook/Thumbnail.png` |
   
   All five are sub-types of `application/zip` and are added to ZipParser's zip 
specializations so the type is kept. Krita and OpenRaster are already 
identified by their `mimetype` entry through OpenDocumentDetector; the others 
by extension. Because the types are zip sub-types, a file with a colliding 
extension that is not a zip (an Oracle `tnsnames.ora`) keeps its detected type. 
The preview is only picked on the `ZipFile` path: 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.xml` are 
ignored, each fixed path is marked, a missing preview marks nothing, and a 
plain `.zip` gets no thumbnail. Also checked by hand against one real file of 
each format: the preset returned exactly the stored preview for all five, and 
204 before.
   
   3MF (`Metadata/thumbnail.png`) can be added once TIKA-5031 makes 3MF a zip 
sub-type. Sketch is left out for lack of a real file carrying 
`previews/preview.png`.
   
   https://issues.apache.org/jira/browse/TIKA-5032
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to