ls: Fix listing versions when the system clock is off (#4370)

This commit is contained in:
Anis Elleuch
2022-11-15 07:55:05 -08:00
committed by GitHub
parent 3ee6095c47
commit 89b53a7e52
2 changed files with 1 additions and 8 deletions
+1 -5
View File
@@ -1759,10 +1759,6 @@ func (c *S3Client) listVersions(ctx context.Context, b, o string, isRecursive bo
}
func (c *S3Client) listVersionsRoutine(ctx context.Context, b, o string, isRecursive bool, timeRef time.Time, includeOlderVersions, withDeleteMarkers bool, objectInfoCh chan minio.ObjectInfo) {
if timeRef.IsZero() {
timeRef = time.Now().UTC()
}
var buckets []string
if b == "" {
bucketsInfo, err := c.api.ListBuckets(ctx)
@@ -1797,7 +1793,7 @@ func (c *S3Client) listVersionsRoutine(ctx context.Context, b, o string, isRecur
continue
}
if objectVersion.LastModified.Before(timeRef) {
if timeRef.IsZero() || objectVersion.LastModified.Before(timeRef) {
skipKey = objectVersion.Key
// Skip if this is a delete marker and we are not asked to list it
-3
View File
@@ -175,9 +175,6 @@ func checkListSyntax(ctx context.Context, cliCtx *cli.Context) ([]string, doList
listZip := cliCtx.Bool("zip")
timeRef := parseRewindFlag(cliCtx.String("rewind"))
if timeRef.IsZero() && withOlderVersions {
timeRef = time.Now().UTC()
}
if listZip && (withOlderVersions || !timeRef.IsZero()) {
fatalIf(errInvalidArgument().Trace(args...), "Zip file listing can only be performed on the latest version")