diff --git a/cmd/untar.go b/cmd/untar.go index 4d6698aeb..143462483 100644 --- a/cmd/untar.go +++ b/cmd/untar.go @@ -30,6 +30,7 @@ import ( "path" "runtime" "sync" + "time" "github.com/cosnicolaou/pbzip2" "github.com/klauspost/compress/s2" @@ -259,6 +260,12 @@ func untar(ctx context.Context, r io.Reader, putObject func(reader io.Reader, in continue } + // If zero or earlier modtime, set to current. + // Otherwise the resulting objects will be invalid. + if header.ModTime.UnixNano() <= 0 { + header.ModTime = time.Now() + } + // Sync upload. rc := disconnectReader{r: tarReader} if err := putObject(&rc, header.FileInfo(), name); err != nil {