Skip to content

Commit

Permalink
feat: rewrite file modtime in zip files
Browse files Browse the repository at this point in the history
  • Loading branch information
aidansteele committed Jun 20, 2021
1 parent 22e85ab commit d020a17
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/zipper/zipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path/filepath"
"time"
)

func Zip(path string) (string, error) {
Expand Down Expand Up @@ -74,6 +75,11 @@ func addFileToZip(zw *zip.Writer, topPath, path string) error {
return err
}

// we intentionally ignore the file's modtime because if the _content_ of the zip file
// is the same (as determined by an md5) then we will skip an upload altogether. this
// date was chosen because jan 1st 1970 can sometimes look like a bug - this is deliberate.
fh.Modified = time.Date(1989, 4, 25, 0, 0, 0, 0, time.UTC).UTC()

relPath, err := filepath.Rel(topPath, path)
if err != nil {
return err
Expand Down

0 comments on commit d020a17

Please sign in to comment.