Allow hyphens and underscores in basepath

pull/3697/head
Jared Scheib 2018-06-15 17:05:01 -07:00
parent bbf496047b
commit edccd447c5
2 changed files with 8 additions and 1 deletions

View File

@ -540,6 +540,6 @@ func clientUsage(values client.Values) *client.Usage {
}
func validBasepath(basepath string) bool {
re := regexp.MustCompile(`(\/{1}\w+)+`)
re := regexp.MustCompile(`(\/{1}[\w-]+)+`)
return re.ReplaceAllLiteralString(basepath, "") == ""
}

View File

@ -43,6 +43,13 @@ func Test_validBasepath(t *testing.T) {
},
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",
args: args{