mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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>
This commit is contained in:
parent
84d1f76092
commit
541c5dbb81
3 changed files with 16 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue