summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-01-07 01:45:37 (GMT)
committerGitHub <noreply@github.com>2024-01-07 01:45:37 (GMT)
commitdb6f297d448ce46e58a5b90239a4779553333198 (patch)
tree5815dc2c1e9fb9c7ca5128d0228d11d585044f44 /Lib/zipfile
parent4d5328cbebc441ed2539ad3b2ea30a01eb059ef7 (diff)
downloadcpython-db6f297d448ce46e58a5b90239a4779553333198.zip
cpython-db6f297d448ce46e58a5b90239a4779553333198.tar.gz
cpython-db6f297d448ce46e58a5b90239a4779553333198.tar.bz2
[3.12] gh-112795: Allow `/` folder in a zipfile (GH-112932) (#113789)
gh-112795: Allow `/` folder in a zipfile (GH-112932) Allow extraction (no-op) of a "/" folder in a zipfile, they are commonly added by some archive creation tools. (cherry picked from commit 541c5dbb81c784afd587406be2cc82645979a107) Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/zipfile')
-rw-r--r--Lib/zipfile/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index 420d2f8..e289c6c 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -1758,7 +1758,7 @@ class ZipFile:
# filter illegal characters on Windows
arcname = self._sanitize_windows_name(arcname, os.path.sep)
- if not arcname:
+ if not arcname and not member.is_dir():
raise ValueError("Empty filename.")
targetpath = os.path.join(targetpath, arcname)