From 8848d8affe8a7e8c9d312b62521860798287e2f0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 28 Sep 2022 02:58:16 -0700 Subject: [PATCH] update tags regexp to include space character as valid --- pkg/tags/tags.go | 2 +- pkg/tags/tags_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/tags/tags.go b/pkg/tags/tags.go index 0823ea862..98ae17efa 100644 --- a/pkg/tags/tags.go +++ b/pkg/tags/tags.go @@ -69,7 +69,7 @@ const ( // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions // borrowed from this article and also testing various ASCII characters following regex // is supported by AWS S3 for both tags and values. -var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@]+$`) +var validTagKeyValue = regexp.MustCompile(`^[a-zA-Z0-9-+\-._:/@ ]+$`) func checkKey(key string) error { if len(key) == 0 { diff --git a/pkg/tags/tags_test.go b/pkg/tags/tags_test.go index cfdc46666..89b68cc17 100644 --- a/pkg/tags/tags_test.go +++ b/pkg/tags/tags_test.go @@ -31,6 +31,14 @@ func TestParseTags(t *testing.T) { "key1=value1&key2=value2", false, }, + { + "store+forever=false&factory=true", + false, + }, + { + " store forever =false&factory=true", + false, + }, { fmt.Sprintf("%0128d=%0256d", 1, 1), false,