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/26 11:19:15 UTC

[GitHub] [sling-org-apache-sling-commons-contentdetection] ankitaagar opened a new pull request #1: MIME Type detection leaks temporary files when given a ZIP file

ankitaagar opened a new pull request #1: MIME Type detection leaks temporary files when given a ZIP file
URL: https://github.com/apache/sling-org-apache-sling-commons-contentdetection/pull/1
 
 
   

----------------------------------------------------------------
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

[GitHub] [sling-org-apache-sling-commons-contentdetection] kwin commented on a change in pull request #1: MIME Type detection leaks temporary files when given a ZIP file

Posted by GitBox <gi...@apache.org>.
kwin commented on a change in pull request #1: MIME Type detection leaks temporary files when given a ZIP file
URL: https://github.com/apache/sling-org-apache-sling-commons-contentdetection/pull/1#discussion_r384431929
 
 

 ##########
 File path: src/main/java/org/apache/sling/commons/contentdetection/internal/ContentAwareMimeTypeServiceImpl.java
 ##########
 @@ -52,10 +53,14 @@ 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();
 
 Review comment:
   Please use try with resources and don't forget to close tmp: https://tika.apache.org/1.8/api/org/apache/tika/io/TikaInputStream.html#get(java.io.InputStream,%20org.apache.tika.io.TemporaryResources)

----------------------------------------------------------------
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

[GitHub] [sling-org-apache-sling-commons-contentdetection] ankitaagar closed pull request #1: MIME Type detection leaks temporary files when given a ZIP file

Posted by GitBox <gi...@apache.org>.
ankitaagar closed pull request #1: MIME Type detection leaks temporary files when given a ZIP file
URL: https://github.com/apache/sling-org-apache-sling-commons-contentdetection/pull/1
 
 
   

----------------------------------------------------------------
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