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:
Klaus Post
2024-07-11 11:01:28 -07:00
committed by GitHub
parent ddfd44cb35
commit 86de4b4395
10 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
}
}