From 6cc1620fb317b42cea4c416b7d8ba9cf5ec6018a Mon Sep 17 00:00:00 2001 From: David Lynch Date: Thu, 17 Oct 2019 22:28:46 -0500 Subject: [PATCH] Spec-compliance: metadata shouldn't be compressed --- ebook/epub.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ebook/epub.py b/ebook/epub.py index 87a0787..fa21295 100644 --- a/ebook/epub.py +++ b/ebook/epub.py @@ -39,8 +39,8 @@ def make_epub(filename, html_files, meta, extra_files=False, compress=True): filename = sanitize_filename(filename) epub = zipfile.ZipFile(filename, 'w', compression=compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) - # The first file must be named "mimetype" - epub.writestr("mimetype", "application/epub+zip") + # The first file must be named "mimetype", and shouldn't be compressed + epub.writestr("mimetype", "application/epub+zip", compress_type=zipfile.ZIP_STORED) # We need an index file, that lists all other HTML files # This index file itself is referenced in the META_INF/container.xml