From df8215fdc75ce920a2f5392f6444f8a2750a92c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20HOUZ=C3=89?= Date: Mon, 12 Apr 2021 23:57:57 +0200 Subject: [PATCH] fix: prefer to set mod time to oldes allowed by zip As spotted in https://www.mindprod.com/jgloss/zip.html > The format does not support dates prior to 1980-01-01 0:00 UTC . Avoid file dates 1980-01-01 or earlier (local or UTC time). --- internal/provider/zip_archiver.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/provider/zip_archiver.go b/internal/provider/zip_archiver.go index aa5826ea..6356e53b 100644 --- a/internal/provider/zip_archiver.go +++ b/internal/provider/zip_archiver.go @@ -59,8 +59,9 @@ func (a *ZipArchiver) ArchiveFile(infilename string) error { } fh.Name = filepath.ToSlash(fi.Name()) fh.Method = zip.Deflate + oldestZipSupportedModTime, _ := time.Parse(time.RFC3339, "1980-01-01T00:00:00+00:00") // fh.Modified alone isn't enough when using a zero value - fh.SetModTime(time.Time{}) + fh.SetModTime(oldestZipSupportedModTime) f, err := a.writer.CreateHeader(fh) if err != nil { @@ -134,8 +135,9 @@ func (a *ZipArchiver) ArchiveDir(indirname string, excludes []string) error { } fh.Name = filepath.ToSlash(relname) fh.Method = zip.Deflate + oldestZipSupportedModTime, _ := time.Parse(time.RFC3339, "1980-01-01T00:00:00+00:00") // fh.Modified alone isn't enough when using a zero value - fh.SetModTime(time.Time{}) + fh.SetModTime(oldestZipSupportedModTime) f, err := a.writer.CreateHeader(fh) if err != nil {