Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-2611

Tika mistakenly determines mimetype of .js file as application/x-elc

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.17
    • Fix Version/s: 2.0.0
    • Component/s: detector
    • Labels:
      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);
          }
      }

        Attachments

        1. 980x240_edge.js
          3 kB
          Anto

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Sarhanto Anto
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: