Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always set the filter to skip navigating #12984

Merged
merged 1 commit into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/metacache-server-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) (
o.parseMarker()
o.BaseDir = baseDirFromPrefix(o.Prefix)
o.Transient = o.Transient || isReservedOrInvalidBucket(o.Bucket, false)
o.SetFilter()
harshavardhana marked this conversation as resolved.
Show resolved Hide resolved
if o.Transient {
o.Create = false
}
Expand Down
9 changes: 5 additions & 4 deletions cmd/metacache-walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
var scanDir func(path string) error

scanDir = func(current string) error {
// always skip the directory that doesn't match the prefix
if len(current) > 0 && !strings.HasPrefix(current, prefix) {
return nil
}

// Skip forward, if requested...
forward := ""
if len(opts.ForwardTo) > 0 && strings.HasPrefix(opts.ForwardTo, current) {
Expand Down Expand Up @@ -138,9 +143,6 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
}
dirObjects := make(map[string]struct{})
for i, entry := range entries {
if len(prefix) > 0 && !strings.HasPrefix(entry, prefix) {
continue
}
harshavardhana marked this conversation as resolved.
Show resolved Hide resolved
if len(forward) > 0 && entry < forward {
continue
}
Expand Down Expand Up @@ -197,7 +199,6 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
// Process in sort order.
sort.Strings(entries)
dirStack := make([]string, 0, 5)
prefix = "" // Remove prefix after first level.
harshavardhana marked this conversation as resolved.
Show resolved Hide resolved
if len(forward) > 0 {
idx := sort.SearchStrings(entries, forward)
if idx > 0 {
Expand Down