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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.17
    • 2.0.0-BETA
    • detector
    • 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

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

            Dates

              Created:
              Updated: