mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Nicer error messages for unknown compression type
This commit is contained in:
parent
67060de830
commit
8bbd389d0f
@ -42,6 +42,7 @@ ZIP_MAX_COMMENT = (1 << 16) - 1
|
||||
ZIP_STORED = 0
|
||||
ZIP_DEFLATED = 8
|
||||
# Other ZIP compression methods not supported
|
||||
# For a list see: http://www.winzip.com/wz54.htm
|
||||
|
||||
# Below are some formats and associated data for reading/writing headers using
|
||||
# the struct module. The names and structures of headers/records are those used
|
||||
@ -721,7 +722,7 @@ class ZipFile:
|
||||
raise RuntimeError(
|
||||
"Compression requires the (missing) zlib module")
|
||||
else:
|
||||
raise RuntimeError("That compression method is not supported")
|
||||
raise RuntimeError("The compression method %s is not supported" % compression)
|
||||
|
||||
self._allowZip64 = allowZip64
|
||||
self._didModify = False
|
||||
@ -1171,7 +1172,7 @@ class ZipFile:
|
||||
"Compression requires the (missing) zlib module")
|
||||
if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
|
||||
raise RuntimeError(
|
||||
"That compression method is not supported")
|
||||
"The compression method %s is not supported" % zinfo.compress_type)
|
||||
if zinfo.file_size > ZIP64_LIMIT:
|
||||
if not self._allowZip64:
|
||||
raise LargeZipFile("Filesize would require ZIP64 extensions")
|
||||
|
Loading…
x
Reference in New Issue
Block a user