From 8c1a244b1ea3c32983dbebb7877628c6315388a5 Mon Sep 17 00:00:00 2001 From: prculley Date: Fri, 23 Feb 2018 07:59:01 -0600 Subject: [PATCH] Fix export gpkg when media files have fractional timestamps. Fixes #10424 --- gramps/plugins/export/exportpkg.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/export/exportpkg.py b/gramps/plugins/export/exportpkg.py index 08fd978a8..0ce54969a 100644 --- a/gramps/plugins/export/exportpkg.py +++ b/gramps/plugins/export/exportpkg.py @@ -86,6 +86,12 @@ def writeData(database, filename, user, option_box=None): writer = PackageWriter(database, filename, user) return writer.export() + +def fix_mtime(tarinfo): + """ this fixes a bug in the python tarfile GNU_FORMAT where if mtime has + a fractional component, it fails.""" + tarinfo.mtime = int(tarinfo.mtime) + return tarinfo #------------------------------------------------------------------------- # # PackageWriter @@ -186,7 +192,7 @@ class PackageWriter: filename = media_path_full(self.db, mobject.get_path()) archname = str(mobject.get_path()) if os.path.isfile(filename) and os.access(filename, os.R_OK): - archive.add(filename, archname) + archive.add(filename, archname, filter=fix_mtime) # Write XML now g = BytesIO()