New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZipFile don't overwrite compresed files at create #55624
Comments
I've created a new, compresed ZipFile in memory (using StringIO) and added several files to it with ZipFile.write(), later i've added a new file with the same name of one of the previous ones just to overwrite it with some dinamic data using ZipFile.writestr(), and finally i've closed the StringIO ZipFile and writen to the hard disk. Secondly, i've opened it with FileRoller and found that the overwritten file is twice inside the ZipFile, the first and the second one, with different sizes and timestamp. Luckily, extracting one of them just get only the more recent one, but the fact is that the old one is already there and it's listed instead being overwritten with the last, new one, and i don't know if it's a bug (i think so) or just a feature. |
It's not only luck: a Zip file has a "central directory" used to retrieve data. ZipFile just appends the new file data to the end of the Zip file, then write the updated directory structure. Removing the old content is another matter, and is similar to bpo-6818. |
Ok, they talk about remove it, that's why i didn't found it :-P Ok, it make sense. By the way, this way the old data is available? How? (Just to know... it could be a courious feature :-D ) |
2.6 is only open for security fixes. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: