Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.17
-
None
Description
Attached file is misinterpreted as being an application/x-elc file when it's really just a plain javascript file.
Using:
private final DefaultDetector mimeTypeDetector = new DefaultDetector(); public String determineMimeType(final byte[] data, final String fileName) { final TikaInputStream inputStream = TikaInputStream.get(data); final Metadata metadata = new Metadata(); metadata.set(Metadata.RESOURCE_NAME_KEY, fileName); try { return mimeTypeDetector.detect(inputStream, metadata).toString(); } catch (final IOException e) { throw new ApiException(e); } }