diff options
author | Jan Mazur <16736821+mzr@users.noreply.github.com> | 2020-09-28 18:53:33 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 18:53:33 (GMT) |
commit | ff9147d93b868f0e13b9fe14e2a76c2879f6787b (patch) | |
tree | fbfb36ce08a859c0ce11a8247b311083933f8d3c /Lib/zipfile.py | |
parent | a195bceff7b552c5f86dec7894ff24dcc87235da (diff) | |
download | cpython-ff9147d93b868f0e13b9fe14e2a76c2879f6787b.zip cpython-ff9147d93b868f0e13b9fe14e2a76c2879f6787b.tar.gz cpython-ff9147d93b868f0e13b9fe14e2a76c2879f6787b.tar.bz2 |
bpo-40105: ZipFile truncate in append mode with shorter comment (GH-19337)
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 915698f..816f858 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1918,6 +1918,8 @@ class ZipFile: centDirSize, centDirOffset, len(self._comment)) self.fp.write(endrec) self.fp.write(self._comment) + if self.mode == "a": + self.fp.truncate() self.fp.flush() def _fpclose(self, fp): |