summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2022-02-14 12:19:01 +0000
committerDavid Faure <faure@kde.org>2022-03-13 11:19:03 +0000
commitb5df32dc4cbd6b77671371384944c37225310af8 (patch)
tree5b918cdb39c497d4ee3a941334b4e7dc1d7ea008 /data
parenta3cdc940478fc312eb9525eef68acfa8f7bb6331 (diff)
downloadshared-mime-info-b5df32dc4cbd6b77671371384944c37225310af8.tar.gz
text/x-qml: Lower match priority to avoid conflicts with Python
GLib takes priorities >= 80 to mean a short-circuit to a magic match, overriding any conflicting matching globs. More generally, high priority magic should only be used if it’s really unlikely that the magic will match anything except the given MIME type. That’s evidently not true here. Some Python files which import Qt modules can look like valid QML files, matching the magic but not the glob. Lower the priority of the magic so that it doesn’t trigger the short-circuit code in GLib. This means the name match is guessed as the right one instead of the magic match. See https://gitlab.gnome.org/GNOME/glib/-/blob/6ee71750a532d8de5eaed5cf12e8718738ddd5c6/gio/gcontenttype.c#L840 and https://gitlab.gnome.org/GNOME/glib/-/issues/2599. Tested with `XDG_DATA_DIRS=$buildroot/share gio info ./not-qml.py`. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #84
Diffstat (limited to 'data')
-rw-r--r--data/freedesktop.org.xml.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in
index 4840c3ea..367483a7 100644
--- a/data/freedesktop.org.xml.in
+++ b/data/freedesktop.org.xml.in
@@ -2019,7 +2019,7 @@ command to generate the output files.
<mime-type type="text/x-qml">
<comment>Qt Markup Language file</comment>
<sub-class-of type="text/plain"/>
- <magic priority="80">
+ <magic priority="50">
<match type="string" value="/bin/env qml" offset="2:16"/>
<match type="string" value="import Qt" offset="0:3000">
<match type="string" value="{" offset="9:3009"/>