diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2021-09-08 09:34:42 +0300 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2021-09-08 09:40:11 +0300 |
commit | fe73d839b4ed8348a783173ecea37ca90dd578d5 (patch) | |
tree | b2b00ef63d2a1f732da1d59280c8d5b79c7e0d73 | |
parent | 46b84f431d1435778f8f3811e6fceb0ab5190cb8 (diff) | |
download | shared-mime-info-fe73d839b4ed8348a783173ecea37ca90dd578d5.tar.gz |
application/x-apple-systemprofiler+xml: require _SPCommandLineArguments in plistwork/scop/jpeg-vs-systemprofiler
Look for `<key>_SPCommandLineArguments</key>` in addition to plist root
element to distinguish from other property list XML files.
Our offset specifiers aren't that fancy, so this can trigger on files
that have the above string ´_before_ `<plist version="1.0"`, but those
should be quite pathological cases.
Start offset 34 is length of `<plist version="1.0"><array><dict>`, 384
is arbitrary guesswork.
Closes https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/169
-rw-r--r-- | data/freedesktop.org.xml.in | 4 | ||||
-rw-r--r-- | tests/mime-detection/test_apple_systemprofiler.spx | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in index 934e2e5c..75235b3e 100644 --- a/data/freedesktop.org.xml.in +++ b/data/freedesktop.org.xml.in @@ -468,7 +468,9 @@ command to generate the output files. <comment>Apple System Profiler</comment> <sub-class-of type="application/xml"/> <magic priority="50"> - <match type="string" value="<plist version="1.0"" offset="0:256"/> + <match type="string" value="<plist version="1.0"" offset="0:256"> + <match type="string" value="<key>_SPCommandLineArguments</key>" offset="34:384"/> + </match> </magic> <glob pattern="*.spx" weight="40"/> <root-XML namespaceURI="http://www.apple.com/DTDs/PropertyList-1.0.dtd" localName="plist"/> diff --git a/tests/mime-detection/test_apple_systemprofiler.spx b/tests/mime-detection/test_apple_systemprofiler.spx index 28834e96..cdafe0ee 100644 --- a/tests/mime-detection/test_apple_systemprofiler.spx +++ b/tests/mime-detection/test_apple_systemprofiler.spx @@ -2,6 +2,9 @@ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array> + <dict> + <key>_SPCommandLineArguments</key> <!-- Incomplete file, used to test for extension mismatch vs Speex *.spx --> + </dict> </array> </plist> |