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 743ef2f commit 751652dCopy full SHA for 751652d
paths.go
@@ -167,11 +167,11 @@ func (p *Path) Clean() *Path {
167
// IsInsideDir returns true if the current path is inside the provided
168
// dir
169
func (p *Path) IsInsideDir(dir *Path) (bool, error) {
170
- rel, err := filepath.Rel(p.path, dir.path)
+ rel, err := filepath.Rel(dir.path, p.path)
171
if err != nil {
172
return false, err
173
}
174
- return strings.Contains(rel, ".."+string(os.PathSeparator)) || rel == "..", nil
+ return !strings.Contains(rel, ".."+string(os.PathSeparator)) && rel != ".." && rel != ".", nil
175
176
177
// Parent returns all but the last element of path, typically the path's
0 commit comments