mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Fix closes Issue6090 - Raise a ValueError, instead of failing with unrelated
exceptions, when a document with timestamp earlier than 1980 is provided to zipfile. Patch contributed by Petri Lehtinen.
This commit is contained in:
parent
59a06d412d
commit
ddd40312d5
4 changed files with 22 additions and 1 deletions
|
|
@ -290,6 +290,10 @@ class ZipInfo (object):
|
|||
|
||||
self.filename = filename # Normalized file name
|
||||
self.date_time = date_time # year, month, day, hour, min, sec
|
||||
|
||||
if date_time[0] < 1980:
|
||||
raise ValueError('ZIP does not support timestamps before 1980')
|
||||
|
||||
# Standard values:
|
||||
self.compress_type = ZIP_STORED # Type of compression for the file
|
||||
self.comment = "" # Comment for each file
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue