New submission from Garrison Taylor <garrison.tay...@gridunity.com>:
Currently the zipfile library allows you to create invalid zip files. The following code is an example: from zipfile import ZipFile import tempfile temporary_file = tempfile.NamedTemporaryFile() my_zip = ZipFile(temporary_file.name, 'w') my_zip.writestr('/some_folder/some_file.txt', 'Some content') my_zip.close() The generated zipfile contains "/some_folder/some_file.txt". However, according to the specification for zip files, this is invalid. See below, from the .ZIP File Format Specification version 6.3.9: 4.4.17.1 The name of the file, with optional relative path. The path stored MUST NOT contain a drive or device letter, or a leading slash. All slashes MUST be forward slashes '/' as opposed to backwards slashes '\' for compatibility with Amiga and UNIX file systems etc. If input came from standard input, there is no file name field. This is significant because the default Windows Explorer zip file extractor cannot handle zip files that contain a leading slash, producing an error that "The compressed (zipped) folder is invalid." ---------- components: Library (Lib) messages: 385934 nosy: garrison.taylor priority: normal severity: normal status: open title: Zipfile with leading slashes type: behavior versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43066> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com