You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
assignee=Noneclosed_at=<Date2020-09-28.18:54:51.480>created_at=<Date2020-03-29.20:48:23.704>labels= ['3.8', 'type-bug', 'library', '3.9', '3.10']
title="Updating zip comment doesn't truncate the zip file"updated_at=<Date2020-09-28.20:18:50.333>user='https://github.com/yudilevi2'
Updating the zip file comment to a shorter comment should truncate the zip file at the end of the new comment.
Instead, the new comment is written to the zip file but the file length stays the same.
For example, for a zip file that has the following zip comment:
b'This is my old amazing comment, I bet you really like it!' # 57 character long
Executing the following code:
zipFile=ZipFile(filePath, 'a')
zipFile.comment=b'My new shorter comment'# 22 character longzipFile.close()
Will actually update the comment length in the zip header to the correct new length (22), but the bytecode will still have the following data:
b'My new shorter comment comment, I bet you really like it!'
Python reads the comment correctly since it relies on the comment length from the metadata (as far as I can tell), but the file is corrupt.
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: