Marius Dumitru Florea created TIKA-3686:
-------------------------------------------
Summary: CSS file detected as JavaScript (application/javascript)
Key: TIKA-3686
URL: https://issues.apache.org/jira/browse/TIKA-3686
Project: Tika
Issue Type: Bug
Components: detector
Affects Versions: 2.0.0-ALPHA
Reporter: Marius Dumitru Florea
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:
{noformat}
TikaUtils.detect(InputStream stream, String name)
{noformat}
The reason seems to be that the CSS file starts with:
{noformat}
/*!
* jQuery
{noformat}
which matches the "jQuery" entry from
[tika-mimetypes.xml|https://github.com/apache/tika/blob/2.3.0/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml#L348]
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.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)