Skip to content

Commit 4d498de

Browse files
authored
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.
1 parent ddfd44c commit 4d498de

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

cmd/legalhold-info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func showLegalHoldInfo(ctx context.Context, urlStr, versionID string, timeRef ti
177177
continue
178178
}
179179

180-
if !recursive && alias+getKey(content) != getStandardizedURL(urlStr) {
180+
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(urlStr) {
181181
break
182182
}
183183

cmd/legalhold-set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func setLegalHold(ctx context.Context, urlStr, versionID string, timeRef time.Ti
129129
continue
130130
}
131131

132-
if !recursive && alias+getKey(content) != getStandardizedURL(urlStr) {
132+
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(urlStr) {
133133
break
134134
}
135135

cmd/retention-common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func applyRetention(ctx context.Context, op lockOpType, target, versionID string
235235
continue
236236
}
237237

238-
if !isRecursive && alias+getKey(content) != getStandardizedURL(target) {
238+
if !isRecursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(target) {
239239
break
240240
}
241241

cmd/retention-info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func getRetention(ctx context.Context, target, versionID string, timeRef time.Ti
346346
continue
347347
}
348348

349-
if !isRecursive && alias+getKey(content) != getStandardizedURL(target) {
349+
if !isRecursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(target) {
350350
break
351351
}
352352

cmd/rm-main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ func listAndRemove(url string, opts removeOpts) error {
469469
}
470470

471471
if !opts.isRecursive {
472-
currentObjectURL := targetAlias + getKey(content)
472+
currentObjectURL := getStandardizedURL(targetAlias + getKey(content))
473473
standardizedURL := getStandardizedURL(currentObjectURL)
474474
if !strings.HasPrefix(url, standardizedURL) {
475475
break

cmd/stat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func statURL(ctx context.Context, targetURL, versionID string, timeRef time.Time
295295
continue
296296
}
297297

298-
url := targetAlias + getKey(content)
298+
url := getStandardizedURL(targetAlias + getKey(content))
299299
standardizedURL := getStandardizedURL(targetURL)
300300

301301
if !isRecursive && !strings.HasPrefix(filepath.FromSlash(url), standardizedURL) && !filepath.IsAbs(url) {

cmd/tag-list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func mainListTag(cliCtx *cli.Context) error {
235235
continue
236236
}
237237

238-
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
238+
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
239239
break
240240
}
241241

cmd/tag-remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func mainRemoveTag(cliCtx *cli.Context) error {
192192
continue
193193
}
194194

195-
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
195+
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
196196
break
197197
}
198198

cmd/tag-set.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func mainSetTag(cliCtx *cli.Context) error {
210210
continue
211211
}
212212

213-
if !recursive && alias+getKey(content) != getStandardizedURL(targetURL) {
213+
if !recursive && getStandardizedURL(alias+getKey(content)) != getStandardizedURL(targetURL) {
214214
break
215215
}
216216

cmd/undo-main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func undoURL(ctx context.Context, aliasedURL string, last int, recursive, dryRun
227227
}
228228

229229
if !recursive {
230-
if alias+getKey(content) != getStandardizedURL(aliasedURL) {
230+
if getStandardizedURL(alias+getKey(content)) != getStandardizedURL(aliasedURL) {
231231
break
232232
}
233233
}

0 commit comments

Comments
 (0)