Skip to content

Commit 7158139

Browse files
committed
OAS-9960 | less strict ArangoRoute path validation
1 parent faf43e7 commit 7158139

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- (Maintenance) Switch to google.golang.org/protobuf
2727
- (Feature) Add DebugPackage to the OPS Binary
2828
- (Feature) (Networking) ArangoRoute Protocol
29+
- (Improvement) Drop slash requirement from ArangoRoute
2930

3031
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
3132
- (Feature) ArangoRoute CRD

pkg/apis/shared/validate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636

3737
var (
3838
resourceNameRE = regexp.MustCompile(`^([0-9\-\.a-z])+$`)
39-
apiPathRE = regexp.MustCompile(`^/([_A-Za-z0-9\-]+/)*$`)
39+
apiPathRE = regexp.MustCompile(`^(/[_A-Za-z0-9\-]+)*/?$`)
4040
)
4141

4242
const (

pkg/apis/shared/validate_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Test_ValidateAPIPath(t *testing.T) {
3636
require.NoError(t, ValidateAPIPath(""))
3737
require.NoError(t, ValidateAPIPath("/"))
3838
require.Error(t, ValidateAPIPath("//"))
39-
require.Error(t, ValidateAPIPath("/api/zz"))
39+
require.NoError(t, ValidateAPIPath("/api/zz"))
4040
require.NoError(t, ValidateAPIPath("/api/"))
4141
require.NoError(t, ValidateAPIPath("/api/test/qw/"))
4242
require.NoError(t, ValidateAPIPath("/api/test/2/"))

0 commit comments

Comments
 (0)