Skip to content

Commit 4e90cd4

Browse files
committed
minor
1 parent d88273a commit 4e90cd4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

context/fs.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"os"
99
"path"
1010
"path/filepath"
11+
"strings"
1112
)
1213

1314
// ResolveFS accepts a single input argument of any type
@@ -134,15 +135,11 @@ var ResolveHTTPFS = func(fsOrDir interface{}) http.FileSystem {
134135
// FindNames accepts a "http.FileSystem" and a root name and returns
135136
// the list containing its file names.
136137
func FindNames(fileSystem http.FileSystem, name string) ([]string, error) {
137-
_, filename, ok, err := SafeFilename("", name)
138-
if err != nil {
139-
return nil, err
140-
}
141-
if !ok {
142-
return nil, fmt.Errorf("invalid file name: %s", name)
138+
if strings.Contains(name, "..") {
139+
return nil, fmt.Errorf("invalid root name")
143140
}
144141

145-
f, err := fileSystem.Open(filename)
142+
f, err := fileSystem.Open(name) // it's the root dir.
146143
if err != nil {
147144
return nil, err
148145
}

0 commit comments

Comments
 (0)