Allow hyphens and underscores in basepath
parent
bbf496047b
commit
edccd447c5
|
@ -540,6 +540,6 @@ func clientUsage(values client.Values) *client.Usage {
|
||||||
}
|
}
|
||||||
|
|
||||||
func validBasepath(basepath string) bool {
|
func validBasepath(basepath string) bool {
|
||||||
re := regexp.MustCompile(`(\/{1}\w+)+`)
|
re := regexp.MustCompile(`(\/{1}[\w-]+)+`)
|
||||||
return re.ReplaceAllLiteralString(basepath, "") == ""
|
return re.ReplaceAllLiteralString(basepath, "") == ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,13 @@ func Test_validBasepath(t *testing.T) {
|
||||||
},
|
},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Basepath can include numbers, hyphens, and underscores",
|
||||||
|
args: args{
|
||||||
|
basepath: "/3shishka-bob/-rus4s_rus-1_s-",
|
||||||
|
},
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Basepath is not empty and invalid - no slashes",
|
name: "Basepath is not empty and invalid - no slashes",
|
||||||
args: args{
|
args: args{
|
||||||
|
|
Loading…
Reference in New Issue