We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc7b591 commit 003d9a0Copy full SHA for 003d9a0
modules/storage/local.go
@@ -130,8 +130,7 @@ func (l *LocalStorage) URL(path, name string) (*url.URL, error) {
130
func (l *LocalStorage) IterateObjects(prefix string, fn func(path string, obj Object) error) error {
131
dir := l.dir
132
if prefix != "" {
133
- prefix_trim := filepath.Clean(prefix)
134
- dir = filepath.Join(l.dir, prefix_trim)
+ dir = filepath.Join(l.dir, prefix)
135
if !strings.HasPrefix(dir, strings.TrimSuffix(l.dir, "/")) {
136
return ErrIllegalPath
137
}
modules/storage/local_test.go
@@ -71,11 +71,11 @@ func TestLocalStorageIterator(t *testing.T) {
71
72
73
expected_list := map[string][]string{
74
- "a": {"a/1.txt"},
75
- "b": {"b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
76
- "": {"a/1.txt", "b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
77
- "/": {"a/1.txt", "b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
78
- "/../../../tmp": {}, // empty dir
+ "a": {"a/1.txt"},
+ "b": {"b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
+ "": {"a/1.txt", "b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
+ "/": {"a/1.txt", "b/1.txt", "b/2.txt", "b/3.txt", "b/x 4.txt"},
+ "a/b/../../a": {"a/1.txt"},
79
80
for dir, expected := range expected_list {
81
count := 0
@@ -93,6 +93,7 @@ func TestLocalStorageIterator(t *testing.T) {
93
illegal_dirs := []string{
94
"../a",
95
"../../etc/hosts",
96
+ "../a/../b",
97
98
for _, dir := range illegal_dirs {
99
err = l.IterateObjects(dir, func(path string, f Object) error {
0 commit comments