You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "dschmidt (via GitHub)" <gi...@apache.org> on 2026/08/29 10:23:52 UTC
[PR] TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document [tika]
dschmidt opened a new pull request, #3093:
URL: https://github.com/apache/tika/pull/3093
EpubParser emitted every image as an untyped embedded document, so a client had no way to tell the cover from the other images. The OPF names it: EPUB 3 with the `cover-image` property on the manifest item, EPUB 2 with `<meta name="cover" content="<item id>"/>`. The parser now resolves the cover (property first, meta as fallback) and emits that image as the THUMBNAIL embedded document, like the preview image of the other container formats. Both fixtures cover one of the two ways.
https://issues.apache.org/jira/browse/TIKA-4852
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document [tika]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3093:
URL: https://github.com/apache/tika/pull/3093#discussion_r3886823697
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java:
##########
@@ -442,6 +448,10 @@ private void handleEmbedded(ZipFile zipFile, String relativePath, HRefMediaPair
embeddedMetadata.set(HttpHeaders.CONTENT_TYPE, hRefMediaPair.media);
}
embeddedMetadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, fullPath);
+ if (cover) {
+ embeddedMetadata.set(TikaCoreProperties.EMBEDDED_RESOURCE_TYPE,
+ TikaCoreProperties.EmbeddedResourceType.THUMBNAIL.toString());
+ }
Review Comment:
`handleEmbedded` can be invoked when `hRefMediaPair.media` is null (e.g., OPF item missing `media-type`; `shouldHandleEmbedded(null)` returns true), but later this method unconditionally calls `hRefMediaPair.media.contains("font")`, which will throw a NullPointerException. Guard the `contains` check to keep embedded extraction robust for incomplete/invalid OPFs.
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document [tika]
Posted by "THausherr (via GitHub)" <gi...@apache.org>.
THausherr merged PR #3093:
URL: https://github.com/apache/tika/pull/3093
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4852: EpubParser emits the OPF cover image as a THUMBNAIL embedded document [tika]
Posted by "dschmidt (via GitHub)" <gi...@apache.org>.
dschmidt commented on code in PR #3093:
URL: https://github.com/apache/tika/pull/3093#discussion_r3886882222
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-miscoffice-module/src/main/java/org/apache/tika/parser/epub/EpubParser.java:
##########
@@ -442,6 +448,10 @@ private void handleEmbedded(ZipFile zipFile, String relativePath, HRefMediaPair
embeddedMetadata.set(HttpHeaders.CONTENT_TYPE, hRefMediaPair.media);
}
embeddedMetadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, fullPath);
+ if (cover) {
+ embeddedMetadata.set(TikaCoreProperties.EMBEDDED_RESOURCE_TYPE,
+ TikaCoreProperties.EmbeddedResourceType.THUMBNAIL.toString());
+ }
Review Comment:
Good catch (pre-existing, but this path reaches it more easily now): guarded the font check against a null media type.
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org