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

CSS file detected as JavaScript (application/javascript)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.0.0-ALPHA
    • None
    • detector
    • None

    Description

      The following CSS file https://github.com/techlab/jquery-smartwizard/blob/v5.1.1/dist/css/smart_wizard_all.min.css is detected as application/javascript using:

      TikaUtils.detect(InputStream stream, String name)
      

      The reason seems to be that the CSS file starts with:

      /*!
       * jQuery
      

      which matches the "jQuery" entry from tika-mimetypes.xml used by Tika's MimeTypes detector.

      This is a regression introduced by https://github.com/apache/tika/commit/97699598f000139b1222b785d634b3c8a8e216c7 in TIKA-1141 (2.0.0-ALPHA).

      The implications are serious if the mime type returned by Tika is used to set the content type on the HTTP request returning the CSS file to the browser: the browser ignores the CSS.

      FTR, in my case the CSS file is not served directly from the file system but from a WebJar (in this case https://search.maven.org/artifact/org.webjars.npm/smartwizard/5.1.1/jar ) and we're using Tika to determine the type of files requested from the WebJars.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: