summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2020-02-23 20:41:25 +0100
committerDavid Faure <faure@kde.org>2020-02-23 20:41:25 +0100
commit18bb7cfc6c43d710ecf60339b5dd9bd19c297cdf (patch)
treea2d25777772490e65b301bd43412f87937c28ea2
parent5b342ee056d12a7191b6a50d2cc983228e47eb7b (diff)
downloadshared-mime-info-18bb7cfc6c43d710ecf60339b5dd9bd19c297cdf.tar.gz
Lower weight for "use strict" and similar in the perl mimetype
Otherwise any "use strict" in an HTML file leads to it being detected as perl instead of HTML. https://bugs.kde.org/show_bug.cgi?id=417248
-rw-r--r--data/freedesktop.org.xml.in6
-rw-r--r--tests/mime-detection/list2
-rw-r--r--tests/mime-detection/test-really-html-not-perl.html7
3 files changed, 12 insertions, 3 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index bcac00f4..1a1a1390 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -3350,13 +3350,13 @@ command to generate the output files.
<match type="string" value='eval \"exec /usr/local/bin/perl' offset="0"/>
<match type="string" value="/bin/perl" offset="2:16"/>
<match type="string" value="/bin/env perl" offset="2:16"/>
- <match type="string" value="use strict" offset="0:256"/>
- <match type="string" value="use warnings" offset="0:256"/>
- <match type="string" value="use diagnostics" offset="0:256"/>
<match type="string" value="use Test::" offset="0:256"/>
<match type="string" value="BEGIN {" offset="0:256"/>
</magic>
<magic priority="40">
+ <match type="string" value="use strict" offset="0:256"/>
+ <match type="string" value="use warnings" offset="0:256"/>
+ <match type="string" value="use diagnostics" offset="0:256"/>
<match type="string" value="\n=pod" offset="0:256"/>
<match type="string" value="\n=head1 NAME" offset="0:256"/>
<match type="string" value="\n=head1 DESCRIPTION" offset="0:256"/>
diff --git a/tests/mime-detection/list b/tests/mime-detection/list
index 564812eb..57aa433c 100644
--- a/tests/mime-detection/list
+++ b/tests/mime-detection/list
@@ -88,6 +88,8 @@ test.xht application/xhtml+xml
test-html-with-svg.html text/html
# Copied from https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/98
test-really-html-not-xhtml.html text/html oxx
+# Copied from https://bugs.kde.org/show_bug.cgi?id=417248
+test-really-html-not-perl.html text/html
# Copied from https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/120
test.html text/html
# Copied from http://cvs.fedoraproject.org/viewvc/comps/comps-f11.xml.in?revision=1.306
diff --git a/tests/mime-detection/test-really-html-not-perl.html b/tests/mime-detection/test-really-html-not-perl.html
new file mode 100644
index 00000000..8d677849
--- /dev/null
+++ b/tests/mime-detection/test-really-html-not-perl.html
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ <title></title>
+ <meta content="use strict">
+ </head>
+ <body></body>
+</html>