Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/ingress/inspector/inspector.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ func ValidatePathType(ing *networking.Ingress) error {
}
if path.PathType == nil || *path.PathType != implSpecific {
if isValid := validPathType.MatchString(path.Path); !isValid {
err = errors.Join(err, fmt.Errorf("path %s cannot be used with pathType %s", path.Path, string(*path.PathType)))
pathTypeStr := "nil"
if path.PathType != nil {
pathTypeStr = string(*path.PathType)
}
err = errors.Join(err, fmt.Errorf("path %s cannot be used with pathType %s", path.Path, pathTypeStr))
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions internal/ingress/inspector/inspector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ var (
PathType: &prefix,
Path: "/lala/xp\ntest",
},
{
Path: "notvalidpathname-panics",
},
},
},
},
Expand Down Expand Up @@ -174,6 +177,7 @@ func TestValidatePathType(t *testing.T) {
aErr("xpto/lala", "Exact"),
aErr("/foo/bar/[a-z]{3}", "Prefix"),
aErr("/lala/xp\ntest", "Prefix"),
aErr("notvalidpathname-panics", "nil"),
),
},
}
Expand Down