Skip to content

Commit

Permalink
Merge pull request #174 from crazy-max/toslash
Browse files Browse the repository at this point in the history
followlinks: sanitize root path
  • Loading branch information
tonistiigi authored Jan 26, 2024
2 parents 9f6e333 + b3997ab commit c402261
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions followlinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (r *symlinkResolver) readSymlink(p string, allowWildcard bool) ([]string, e
func statFile(fs FS, root string) (os.DirEntry, error) {
var out os.DirEntry

root = filepath.Clean(root)
root = filepath.ToSlash(filepath.Clean(root))
if root == "/" || root == "." {
return nil, nil
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func statFile(fs FS, root string) (os.DirEntry, error) {
func readDir(fs FS, root string) ([]os.DirEntry, error) {
var out []os.DirEntry

root = filepath.Clean(root)
root = filepath.ToSlash(filepath.Clean(root))
if root == "/" || root == "." {
root = "."
out = make([]gofs.DirEntry, 0)
Expand Down

0 comments on commit c402261

Please sign in to comment.