Skip to content

Commit 8848d8a

Browse files
update tags regexp to include space character as valid
1 parent 53f5600 commit 8848d8a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/tags/tags.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const (
6969
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions
7070
// borrowed from this article and also testing various ASCII characters following regex
7171
// is supported by AWS S3 for both tags and values.
72-
var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@]+$`)
72+
var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@ ]+$`)
7373

7474
func checkKey(key string) error {
7575
if len(key) == 0 {

pkg/tags/tags_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ func TestParseTags(t *testing.T) {
3131
"key1=value1&key2=value2",
3232
false,
3333
},
34+
{
35+
"store+forever=false&factory=true",
36+
false,
37+
},
38+
{
39+
" store forever =false&factory=true",
40+
false,
41+
},
3442
{
3543
fmt.Sprintf("%0128d=%0256d", 1, 1),
3644
false,

0 commit comments

Comments
 (0)