Skip to content

Commit

Permalink
supply prefix filtering when necessary (minio#14772)
Browse files Browse the repository at this point in the history
currently filterPefix was never used and set
that would filter out entries when needed
when `prefix` doesn't end with `/` - this
often leads to objects getting Walked(), Healed()
that were never requested by the caller.
  • Loading branch information
harshavardhana authored Apr 19, 2022
1 parent 4685b76 commit 598ce1e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/erasure-server-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"net/http"
"sort"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -1723,14 +1724,16 @@ func (z *erasureServerPools) Walk(ctx context.Context, bucket, prefix string, re
}

path := baseDirFromPrefix(prefix)
if path == "" {
path = prefix
filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
if path == prefix {
filterPrefix = ""
}

lopts := listPathRawOptions{
disks: disks,
bucket: bucket,
path: path,
filterPrefix: filterPrefix,
recursive: true,
forwardTo: "",
minDisks: 1,
Expand Down Expand Up @@ -1783,14 +1786,16 @@ func listAndHeal(ctx context.Context, bucket, prefix string, set *erasureObjects
}

path := baseDirFromPrefix(prefix)
if path == "" {
path = prefix
filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
if path == prefix {
filterPrefix = ""
}

lopts := listPathRawOptions{
disks: disks,
bucket: bucket,
path: path,
filterPrefix: filterPrefix,
recursive: true,
forwardTo: "",
minDisks: 1,
Expand Down

0 comments on commit 598ce1e

Please sign in to comment.