Merge pull request #3697 from influxdata/fix/basepath_hyphens

Fix allowing hyphens in basepath
pull/3698/head^2
Jared Scheib 2018-06-15 17:30:07 -07:00 committed by GitHub
commit 7571bfe9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,7 @@
1. [#3527](https://github.com/influxdata/chronograf/pull/3527): Ensure cell queries use constraints from TimeSelector
1. [#3573](https://github.com/influxdata/chronograf/pull/3573): Fix Gauge color selection bug
1. [#3649](https://github.com/influxdata/chronograf/pull/3649): Fix erroneous icons in Date Picker widget
1. [#3697](https://github.com/influxdata/chronograf/pull/3697): Fix allowing hyphens in basepath
## v1.5.0.0 [2018-05-15-RC]

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{