From 543dc0dccfa585110944a171777cf7c7324d0a19 Mon Sep 17 00:00:00 2001 From: Marc Sanmiquel Date: Wed, 27 Nov 2024 12:59:19 +0100 Subject: [PATCH 1/2] fix(flameql): allow slashes in tag name --- pkg/og/flameql/flameql.go | 2 +- pkg/og/flameql/flameql_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/og/flameql/flameql.go b/pkg/og/flameql/flameql.go index bca663025e..3f9ba29bb2 100644 --- a/pkg/og/flameql/flameql.go +++ b/pkg/og/flameql/flameql.go @@ -97,7 +97,7 @@ func ValidateAppName(n string) error { } func IsTagKeyRuneAllowed(r rune) bool { - return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_' || r == '.' + return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_' || r == '.' || r == '/' } func IsAppNameRuneAllowed(r rune) bool { diff --git a/pkg/og/flameql/flameql_test.go b/pkg/og/flameql/flameql_test.go index f6baea64e1..04ab9f722d 100644 --- a/pkg/og/flameql/flameql_test.go +++ b/pkg/og/flameql/flameql_test.go @@ -44,6 +44,7 @@ var _ = Describe("ValidateTagKey", func() { testCases := []testCase{ {"foo_BAR_12_baz_qux", nil}, {"service.namespace", nil}, + {"namespace/service", nil}, {ReservedTagKeyName, ErrTagKeyReserved}, {"", ErrTagKeyIsRequired}, From 83b1701f4ec0e4bc21e57c8a7a24bb1c38608a70 Mon Sep 17 00:00:00 2001 From: Marc Sanmiquel Date: Wed, 27 Nov 2024 16:19:15 +0100 Subject: [PATCH 2/2] Update only IsAppNameRuneAllowed to allow slashes --- pkg/og/flameql/flameql.go | 4 ++-- pkg/og/flameql/flameql_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/og/flameql/flameql.go b/pkg/og/flameql/flameql.go index 3f9ba29bb2..c0c5b04ff7 100644 --- a/pkg/og/flameql/flameql.go +++ b/pkg/og/flameql/flameql.go @@ -97,11 +97,11 @@ func ValidateAppName(n string) error { } func IsTagKeyRuneAllowed(r rune) bool { - return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_' || r == '.' || r == '/' + return (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_' || r == '.' } func IsAppNameRuneAllowed(r rune) bool { - return r == '-' || r == '.' || IsTagKeyRuneAllowed(r) + return r == '-' || r == '.' || r == '/' || IsTagKeyRuneAllowed(r) } func IsTagKeyReserved(k string) bool { diff --git a/pkg/og/flameql/flameql_test.go b/pkg/og/flameql/flameql_test.go index 04ab9f722d..5caef67ef1 100644 --- a/pkg/og/flameql/flameql_test.go +++ b/pkg/og/flameql/flameql_test.go @@ -44,7 +44,6 @@ var _ = Describe("ValidateTagKey", func() { testCases := []testCase{ {"foo_BAR_12_baz_qux", nil}, {"service.namespace", nil}, - {"namespace/service", nil}, {ReservedTagKeyName, ErrTagKeyReserved}, {"", ErrTagKeyIsRequired}, @@ -71,6 +70,7 @@ var _ = Describe("ValidateAppName", func() { testCases := []testCase{ {"foo.BAR-1.2_baz_qux", nil}, + {"namespace/service", nil}, {"", ErrAppNameIsRequired}, {"#", ErrInvalidAppName},