Accept empty path as a valid path
This commit is contained in:
parent
cd9e774a73
commit
b550d65943
2 changed files with 8 additions and 2 deletions
|
@ -37,9 +37,9 @@ const (
|
|||
|
||||
var (
|
||||
// pathAlphaNumeric is a regex validation of something like "^/[a-zA-Z]+$" on path
|
||||
pathAlphaNumeric = regexp.MustCompile("^/[" + alphaNumericChars + "]*$").MatchString
|
||||
pathAlphaNumeric = regexp.MustCompile("^[/" + alphaNumericChars + "]*$").MatchString
|
||||
// pathRegexEnabled is a regex validation of paths that may contain regex.
|
||||
pathRegexEnabled = regexp.MustCompile("^/[" + alphaNumericChars + regexEnabledChars + "]*$").MatchString
|
||||
pathRegexEnabled = regexp.MustCompile("^[/" + alphaNumericChars + regexEnabledChars + "]*$").MatchString
|
||||
)
|
||||
|
||||
func GetRemovedHosts(rucfg, newcfg *ingress.Configuration) []string {
|
||||
|
|
|
@ -158,6 +158,12 @@ func TestIsSafePath(t *testing.T) {
|
|||
path string
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "should accept empty path",
|
||||
want: true,
|
||||
copyIng: generateDumbIngressforPathTest(false),
|
||||
path: "",
|
||||
},
|
||||
{
|
||||
name: "should accept valid path with regex disabled",
|
||||
want: true,
|
||||
|
|
Loading…
Reference in a new issue