diff options
author | AN Long <aisk@users.noreply.github.com> | 2024-01-07 01:14:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-07 01:14:18 (GMT) |
commit | 541c5dbb81c784afd587406be2cc82645979a107 (patch) | |
tree | 447178bdd70fd7a8d866fe556e84eea4d8c6bee4 /Lib/zipfile | |
parent | 84d1f76092c24c4d6614797cc10eb8a231397646 (diff) | |
download | cpython-541c5dbb81c784afd587406be2cc82645979a107.zip cpython-541c5dbb81c784afd587406be2cc82645979a107.tar.gz cpython-541c5dbb81c784afd587406be2cc82645979a107.tar.bz2 |
gh-112795: Allow `/` folder in a zipfile (#112932)
Allow extraction (no-op) of a "/" folder in a zipfile, they are commonly added by some archive creation tools.
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__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py index fe629ed..1c415a2 100644 --- a/Lib/zipfile/__init__.py +++ b/Lib/zipfile/__init__.py @@ -1772,7 +1772,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) |