From d29a0beb40622720c2adce84e462f8b9ebfe91a1 Mon Sep 17 00:00:00 2001 From: gnnoh <48518325+gnnoh@users.noreply.github.com> Date: Wed, 16 Feb 2022 09:17:20 +0800 Subject: [PATCH] Fix ValueError when exported files have wrong mtime (#1666) * Fix ValueError when exported files have wrong mtime Set the `strict_timestamps` argument to `False`, so the media files which have a wrong mtime can be normally added to the zipfile. * Update CONTRIBUTORS (ankitects#1666) * Reformat exporting.py --- CONTRIBUTORS | 1 + pylib/anki/exporting.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 3f77cc306..1306fe0bf 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -94,6 +94,7 @@ Spooghetti420 Danish Prakash Araceli Yanez Sam Bradshaw +gnnoh ******************** diff --git a/pylib/anki/exporting.py b/pylib/anki/exporting.py index 2fbaf207c..db433c911 100644 --- a/pylib/anki/exporting.py +++ b/pylib/anki/exporting.py @@ -340,7 +340,9 @@ class AnkiPackageExporter(AnkiExporter): def exportInto(self, path: str) -> None: # open a zip file - z = zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED, allowZip64=True) + z = zipfile.ZipFile( + path, "w", zipfile.ZIP_DEFLATED, allowZip64=True, strict_timestamps=False + ) media = self.doExport(z, path) # media map z.writestr("media", json.dumps(media))