Skip to content

Commit

Permalink
Merge pull request #316 from Cull-Methi/allow-slashes
Browse files Browse the repository at this point in the history
Allow slashes in the flag name regex
  • Loading branch information
zhouzhuojie authored Jan 29, 2020
2 parents 4238989 + c131ad0 commit bdbd3a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var (
keyLengthLimit = 63
keyRegex = regexp.MustCompile(`^[\w\d-]+$`)
keyRegex = regexp.MustCompile(`^[\w\d-/]+$`)

randomKeyCharset = []byte("123456789abcdefghijkmnopqrstuvwxyz")
randomKeyPrefix = "k"
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func TestIsSafeKey(t *testing.T) {
b, msg = IsSafeKey(strings.Repeat("a", 64))
assert.False(t, b)
assert.NotEmpty(t, msg)

b, msg = IsSafeKey("slashes/are/valid")
assert.True(t, b)
assert.Empty(t, msg)
}

func TestPtrs(t *testing.T) {
Expand Down

0 comments on commit bdbd3a5

Please sign in to comment.