Fix export gpkg when media files have fractional timestamps.

Fixes #10424
This commit is contained in:
prculley 2018-02-23 07:59:01 -06:00 committed by Nick Hall
parent 7aa4258046
commit 8c1a244b1e

View File

@ -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()