mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
supply prefix filtering when necessary (#14772)
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.
This commit is contained in:
parent
4685b76e08
commit
598ce1e354
@ -27,6 +27,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -1723,14 +1724,16 @@ func (z *erasureServerPools) Walk(ctx context.Context, bucket, prefix string, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := baseDirFromPrefix(prefix)
|
path := baseDirFromPrefix(prefix)
|
||||||
if path == "" {
|
filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
|
||||||
path = prefix
|
if path == prefix {
|
||||||
|
filterPrefix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
lopts := listPathRawOptions{
|
lopts := listPathRawOptions{
|
||||||
disks: disks,
|
disks: disks,
|
||||||
bucket: bucket,
|
bucket: bucket,
|
||||||
path: path,
|
path: path,
|
||||||
|
filterPrefix: filterPrefix,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
forwardTo: "",
|
forwardTo: "",
|
||||||
minDisks: 1,
|
minDisks: 1,
|
||||||
@ -1783,14 +1786,16 @@ func listAndHeal(ctx context.Context, bucket, prefix string, set *erasureObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := baseDirFromPrefix(prefix)
|
path := baseDirFromPrefix(prefix)
|
||||||
if path == "" {
|
filterPrefix := strings.Trim(strings.TrimPrefix(prefix, path), slashSeparator)
|
||||||
path = prefix
|
if path == prefix {
|
||||||
|
filterPrefix = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
lopts := listPathRawOptions{
|
lopts := listPathRawOptions{
|
||||||
disks: disks,
|
disks: disks,
|
||||||
bucket: bucket,
|
bucket: bucket,
|
||||||
path: path,
|
path: path,
|
||||||
|
filterPrefix: filterPrefix,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
forwardTo: "",
|
forwardTo: "",
|
||||||
minDisks: 1,
|
minDisks: 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user