You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2020/02/27 09:16:32 UTC
[GitHub] [sling-org-apache-sling-commons-contentdetection] ankitaagar
commented on a change in pull request #2: SLING-9153 - MIME Type detection
leaks temporary files when given a ZIP file
ankitaagar commented on a change in pull request #2: SLING-9153 - MIME Type detection leaks temporary files when given a ZIP file
URL: https://github.com/apache/sling-org-apache-sling-commons-contentdetection/pull/2#discussion_r384997750
##########
File path: src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java
##########
@@ -52,10 +52,16 @@ public String getMimeType(String filename, InputStream content) throws IOExcepti
if(!content.markSupported()) {
throw new IllegalArgumentException("Supplied InputStream does not support mark/reset");
}
- TikaInputStream stream = TikaInputStream.get(content);
- Metadata metadata = new Metadata();
- metadata.set(Metadata.RESOURCE_NAME_KEY, filename);
- MediaType mediaType = detector.detect(stream, metadata);
+ MediaType mediaType;
+ TemporaryResources tmp = new TemporaryResources();
+ try {
Review comment:
ok, so I will put it like this
try (TemporaryResources tmp = new TemporaryResources()){ ...}
Is it fine?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services