Message385934
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." |
|
Date |
User |
Action |
Args |
2021-01-29 20:28:48 | garrison.taylor | set | recipients:
+ garrison.taylor |
2021-01-29 20:28:48 | garrison.taylor | set | messageid: <1611952128.43.0.663068649879.issue43066@roundup.psfhosted.org> |
2021-01-29 20:28:48 | garrison.taylor | link | issue43066 messages |
2021-01-29 20:28:48 | garrison.taylor | create | |
|