#887709 shared-mime-info: misidentifies .html file as Perl script when it contains JavaScript "use strict"

Package:
shared-mime-info
Source:
shared-mime-info
Description:
FreeDesktop.org shared MIME database and spec
Submitter:
Dwayne Litzenberger
Date:
2026-07-03 14:17:22 UTC
Severity:
normal
Tags:
#887709#5
Date:
2018-01-19 10:12:52 UTC
From:
To:
An HTML file can be misidentified as a Perl script if it contains "use
strict" in a <script> tag near the beginning of the file, causing
xdg-open to open a text editor instead of a browser in some cases.

The "use strict" directive was introduced in JavaScript 1.8.5
(ECMAScript 5), and it's used by so the assumption that "use strict"
implies Perl is invalid.

I've attached a sample HTML file, which normally gets opened by the
proprietary Dropbox client like this:

    xdg-open 'file:///tmp/dbxBlaBlah.html#0123456789abcdef'

Under KDE, this causes the file to be opened by a text editor (Kate in
my case).  The URL should be opened in a web browser.

Another symptom is that the file is identified as a Perl script when
it's listed in Dolphin (KDE file manager).  Removing the "use strict"
line causes the file to be correctly identified as HTML.

I'm not sure if this is a shared-mime-info bug or a bug somewhere in
KDE.

#887709#10
Date:
2018-04-01 02:46:18 UTC
From:
To:
tags 887709 + patch upstream
forwarded 887709 https://bugs.freedesktop.org/show_bug.cgi?id=105838
thanks

I just attached a patch to fix this, and also filed an upstream bug
report about it.

#887709#21
Date:
2026-07-03 14:11:40 UTC
From:
To:
Package: shared-mime-info
Followup-For: Bug #887709
X-Debbugs-Cc: ac.bugme1+2025-reportbug@mailbox.org
Control: fixed -1 2.0-1
Control: fixed -1 2.2-1
Control: fixed -1 2.4-4
Control: fixed -1 2.4-5+b2
Control: fixed -1 2.4-5+b3
Control: fixed -1 2.4-5+b4
Control: closed -1 2.0-1

Hi all - this bug can be closed.

A patch for this was merged in upstream version 2.0, which has already been
released in Debian. It was not specific to Debian, so if you find that this
issue re-occurs with specific minimal test cases, please do submit a new
issue for us via upstream's GitLab.

https://bugs.freedesktop.org/show_bug.cgi?id=105838
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/work_items/80
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/18bb7cfc6c43d710ecf60339b5dd9bd19c297cdf

I'd like to gently encourage the Debian devs to please review and close
outstanding shared-mime-info bugs in this tracker once 2.5.1 has been
packaged for Debian.


    thanks for the report and the original patch,
    Andrew.