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

Tika mistakenly determines mimetype of .min.js file as matlab

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.17
    • 1.18
    • detector
    • None

    Description

      Attached file is misinterpreted as being a matlab file when it's really just a minimised 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. bannerboy.min.js
          9 kB
          Anto

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: