Skip to content

Conversation

@obfusk
Copy link
Contributor

@obfusk obfusk commented Oct 17, 2022

@obfusk
Copy link
Contributor Author

obfusk commented Oct 17, 2022

NB: this also raises the ValueError for file names consisting entirely of slashes (which are considered directories, even if they actually contain data), which seems correct to me, but (unlike getting rid of the IndexErrors) could potentially break some existing code (though all tests are green).

>>> import zipfile
>>> fh = zipfile.ZipFile("x.zip")
>>> fh.infolist()
[<ZipInfo filename='///' filemode='drwxrwxr-x' external_attr=0x10>]
>>> fh.extract("///", "some_dir")
ValueError: Empty filename.

@obfusk
Copy link
Contributor Author

obfusk commented Oct 17, 2022

Note that unzip fails to extract file names consisting entirely of slashes as well though:

$ unzip x.zip
Archive:  x.zip
warning:  stripped absolute path spec from ///
mapname:  conversion of  failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants