Fix non-recursive compares against alias+key on Windows (#4983)
Many listings would stop after the first version had been processed on Windows, since For example, `mytls/testbucket/trace.json` != `mytls\testbucket\trace.json` would cause `mc undo` to only see one version since this would fail. Use `getStandardizedURL` for both sides of these compares.
This commit is contained in:
@@ -177,7 +177,7 @@ func showLegalHoldInfo(ctx context.Context, urlStr, versionID string, timeRef ti
|
||||
continue
|
||||
}
|
||||
|
||||
if !recursive && alias+getKey(content) != getStandardizedURL(urlStr) {
|
||||
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(urlStr) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ func setLegalHold(ctx context.Context, urlStr, versionID string, timeRef time.Ti
|
||||
continue
|
||||
}
|
||||
|
||||
if !recursive && alias+getKey(content) != getStandardizedURL(urlStr) {
|
||||
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(urlStr) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ func applyRetention(ctx context.Context, op lockOpType, target, versionID string
|
||||
continue
|
||||
}
|
||||
|
||||
if !isRecursive && alias+getKey(content) != getStandardizedURL(target) {
|
||||
if !isRecursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(target) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ func getRetention(ctx context.Context, target, versionID string, timeRef time.Ti
|
||||
continue
|
||||
}
|
||||
|
||||
if !isRecursive && alias+getKey(content) != getStandardizedURL(target) {
|
||||
if !isRecursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(target) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -469,7 +469,7 @@ func listAndRemove(url string, opts removeOpts) error {
|
||||
}
|
||||
|
||||
if !opts.isRecursive {
|
||||
currentObjectURL := targetAlias + getKey(content)
|
||||
currentObjectURL := getStandardizedURL(targetAlias + getKey(content))
|
||||
standardizedURL := getStandardizedURL(currentObjectURL)
|
||||
if !strings.HasPrefix(url, standardizedURL) {
|
||||
break
|
||||
|
||||
+1
-1
@@ -295,7 +295,7 @@ func statURL(ctx context.Context, targetURL, versionID string, timeRef time.Time
|
||||
continue
|
||||
}
|
||||
|
||||
url := targetAlias + getKey(content)
|
||||
url := getStandardizedURL(targetAlias + getKey(content))
|
||||
standardizedURL := getStandardizedURL(targetURL)
|
||||
|
||||
if !isRecursive && !strings.HasPrefix(filepath.FromSlash(url), standardizedURL) && !filepath.IsAbs(url) {
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ func mainListTag(cliCtx *cli.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
|
||||
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ func mainRemoveTag(cliCtx *cli.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
|
||||
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ func mainSetTag(cliCtx *cli.Context) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
|
||||
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ func undoURL(ctx context.Context, aliasedURL string, last int, recursive, dryRun
|
||||
}
|
||||
|
||||
if !recursive {
|
||||
if alias+getKey(content) != getStandardizedURL(aliasedURL) {
|
||||
if getStandardizedURL(alias+getKey(content)) != getStandardizedURL(aliasedURL) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user