Fix isSubPath to allow filenames starting with ".."
This commit is contained in:
@@ -128,3 +128,21 @@ func TestOpenMissingFile(t *testing.T) {
|
||||
t.Errorf("expected 'not found on disk' error, got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSubPath_SameDirectory(t *testing.T) {
|
||||
if !isSubPath("/base", "/base") {
|
||||
t.Error("isSubPath should return true when base == target")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSubPath_ShortChildName(t *testing.T) {
|
||||
if !isSubPath("/base", "/base/a") {
|
||||
t.Error("isSubPath should return true for single-char child path")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsSubPath_DotDotPrefixFilename(t *testing.T) {
|
||||
if !isSubPath("/base", "/base/..foo") {
|
||||
t.Error("isSubPath should return true for filename starting with ..")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user