ls: Fix listing versions when the system clock is off (#4370)
This commit is contained in:
+1
-5
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user