From 1067f1f557dab6a3eac6c8fea9af1de62dd466af Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 5 Aug 2023 13:47:33 -0400 Subject: [PATCH] Avoid matching path separators for '?' in glob. --- newsfragments/+0fed595d.bugfix.rst | 1 + zipp/glob.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 newsfragments/+0fed595d.bugfix.rst diff --git a/newsfragments/+0fed595d.bugfix.rst b/newsfragments/+0fed595d.bugfix.rst new file mode 100644 index 0000000..a12f6e5 --- /dev/null +++ b/newsfragments/+0fed595d.bugfix.rst @@ -0,0 +1 @@ +Avoid matching path separators for '?' in glob. \ No newline at end of file diff --git a/zipp/glob.py b/zipp/glob.py index 4a2e665..63ff8b9 100644 --- a/zipp/glob.py +++ b/zipp/glob.py @@ -8,7 +8,7 @@ def translate(pattern): >>> translate('*.txt') '[^/]*\\.txt' >>> translate('a?txt') - 'a.txt' + 'a[^/]txt' >>> translate('**/*') '.*/[^/]*' """ @@ -36,5 +36,5 @@ def replace(match): re.escape(match.group(0)) .replace('\\*\\*', r'.*') .replace('\\*', r'[^/]*') - .replace('\\?', r'.') + .replace('\\?', r'[^/]') )