Skip to content

Commit f18239d

Browse files
committed
Random access uncompressed unencrypted ZipExtFile
1 parent 8d9f52a commit f18239d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/zipfile/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,13 +1162,16 @@ def seek(self, offset, whence=os.SEEK_SET):
11621162
self._offset = buff_offset
11631163
read_offset = 0
11641164
# Fast seek uncompressed unencrypted file
1165-
elif self._compress_type == ZIP_STORED and self._decrypter is None and read_offset > 0:
1165+
elif self._compress_type == ZIP_STORED and self._decrypter is None:
11661166
# disable CRC checking after first seeking - it would be invalid
11671167
self._expected_crc = None
11681168
# seek actual file taking already buffered data into account
11691169
read_offset -= len(self._readbuffer) - self._offset
11701170
self._fileobj.seek(read_offset, os.SEEK_CUR)
11711171
self._left -= read_offset
1172+
self._compress_left -= read_offset
1173+
if self._eof and read_offset < 0:
1174+
self._eof = False
11721175
read_offset = 0
11731176
# flush read buffer
11741177
self._readbuffer = b''

0 commit comments

Comments
 (0)