mirror of https://github.com/minio/minio.git
fix: set modTime to current in snowball if archive shows empty (#16482)
This commit is contained in:
parent
8fa80874a6
commit
027ff0f3a8
|
@ -30,6 +30,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/cosnicolaou/pbzip2"
|
"github.com/cosnicolaou/pbzip2"
|
||||||
"github.com/klauspost/compress/s2"
|
"github.com/klauspost/compress/s2"
|
||||||
|
@ -259,6 +260,12 @@ func untar(ctx context.Context, r io.Reader, putObject func(reader io.Reader, in
|
||||||
continue
|
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.
|
// Sync upload.
|
||||||
rc := disconnectReader{r: tarReader}
|
rc := disconnectReader{r: tarReader}
|
||||||
if err := putObject(&rc, header.FileInfo(), name); err != nil {
|
if err := putObject(&rc, header.FileInfo(), name); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue