summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_mailcap.py
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2022-06-03 09:43:35 (GMT)
committerGitHub <noreply@github.com>2022-06-03 09:43:35 (GMT)
commitb9509ba7a9c668b984dab876c7926fe1dc5aa0ba (patch)
tree87acb264c690572842b87aa4d21679dd26623b14 /Lib/test/test_mailcap.py
parent5a80e8580e2eb9eac4035d81439ed51523fcc4d2 (diff)
downloadcpython-b9509ba7a9c668b984dab876c7926fe1dc5aa0ba.zip
cpython-b9509ba7a9c668b984dab876c7926fe1dc5aa0ba.tar.gz
cpython-b9509ba7a9c668b984dab876c7926fe1dc5aa0ba.tar.bz2
gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993)
Diffstat (limited to 'Lib/test/test_mailcap.py')
-rw-r--r--Lib/test/test_mailcap.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_mailcap.py b/Lib/test/test_mailcap.py
index d3995b1..8185f4a 100644
--- a/Lib/test/test_mailcap.py
+++ b/Lib/test/test_mailcap.py
@@ -128,7 +128,8 @@ class HelperFunctionTest(unittest.TestCase):
(["", "audio/*", "foo.txt"], ""),
(["echo foo", "audio/*", "foo.txt"], "echo foo"),
(["echo %s", "audio/*", "foo.txt"], "echo foo.txt"),
- (["echo %t", "audio/*", "foo.txt"], "echo audio/*"),
+ (["echo %t", "audio/*", "foo.txt"], None),
+ (["echo %t", "audio/wav", "foo.txt"], "echo audio/wav"),
(["echo \\%t", "audio/*", "foo.txt"], "echo %t"),
(["echo foo", "audio/*", "foo.txt", plist], "echo foo"),
(["echo %{total}", "audio/*", "foo.txt", plist], "echo 3")
@@ -212,7 +213,10 @@ class FindmatchTest(unittest.TestCase):
('"An audio fragment"', audio_basic_entry)),
([c, "audio/*"],
{"filename": fname},
- ("/usr/local/bin/showaudio audio/*", audio_entry)),
+ (None, None)),
+ ([c, "audio/wav"],
+ {"filename": fname},
+ ("/usr/local/bin/showaudio audio/wav", audio_entry)),
([c, "message/external-body"],
{"plist": plist},
("showexternal /dev/null default john python.org /tmp foo bar", message_entry))