mirror of
https://github.com/ciromattia/kcc
synced 2026-05-10 01:32:35 +00:00
ZIP stored instead of deflate (#1283)
This commit is contained in:
@@ -1295,12 +1295,12 @@ def makeZIP(zipfilename, basedir, job_progress='', isepub=False):
|
|||||||
mimetypeFile = open(os.path.join(basedir, '!mimetype'), 'w')
|
mimetypeFile = open(os.path.join(basedir, '!mimetype'), 'w')
|
||||||
mimetypeFile.write('application/epub+zip')
|
mimetypeFile.write('application/epub+zip')
|
||||||
mimetypeFile.close()
|
mimetypeFile.close()
|
||||||
subprocess_run([SEVENZIP, 'a', '-tzip', zipfilename, "*"], capture_output=True, check=True, cwd=basedir)
|
subprocess_run([SEVENZIP, 'a', '-mx0', '-tzip', zipfilename, "*"], capture_output=True, check=True, cwd=basedir)
|
||||||
# crazy hack to ensure mimetype is first when using 7zip
|
# crazy hack to ensure mimetype is first when using 7zip
|
||||||
if isepub:
|
if isepub:
|
||||||
subprocess_run([SEVENZIP, 'rn', zipfilename, '!mimetype', 'mimetype'], capture_output=True, check=True, cwd=basedir)
|
subprocess_run([SEVENZIP, 'rn', zipfilename, '!mimetype', 'mimetype'], capture_output=True, check=True, cwd=basedir)
|
||||||
else:
|
else:
|
||||||
zipOutput = ZipFile(zipfilename, 'w', ZIP_DEFLATED)
|
zipOutput = ZipFile(zipfilename, 'w', ZIP_STORED)
|
||||||
if isepub:
|
if isepub:
|
||||||
zipOutput.writestr('mimetype', 'application/epub+zip', ZIP_STORED)
|
zipOutput.writestr('mimetype', 'application/epub+zip', ZIP_STORED)
|
||||||
for dirpath, _, filenames in os.walk(basedir):
|
for dirpath, _, filenames in os.walk(basedir):
|
||||||
|
|||||||
Reference in New Issue
Block a user