Skip to content

Commit

Permalink
SAK-50150 Kernel not all streams support mark and reset during tika d…
Browse files Browse the repository at this point in the history
…etection (sakaiproject#12622)
  • Loading branch information
ern authored May 29, 2024
1 parent 6626557 commit 3b3348b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5619,8 +5619,10 @@ public void commitResource(ContentResourceEdit edit, int priority) throws OverQu
&& !m_ignoreExtensions.contains(FilenameUtils.getExtension(edit.getId()))
&& !CollectionUtils.containsAny(m_ignoreMimeTypes, currentContentType, detectedByName)) {
try {
// tika detect doesn't modify the original stream
detectedByMagic = tikaDetector.detect(edit.streamContent(), metadata).toString();
// tika detect doesn't modify the original stream but stream must support reset
InputStream stream = new BufferedInputStream(edit.streamContent());
edit.setContent(stream);
detectedByMagic = tikaDetector.detect(stream, metadata).toString();
} catch (Exception e) {
log.warn("tika mimetype detection failed when trying to get the resource data: {}", e.toString());
}
Expand Down

0 comments on commit 3b3348b

Please sign in to comment.