Skip to content

Commit

Permalink
Fix apache#1778: fix binding to the broker
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Oct 23, 2020
1 parent 5d5bd11 commit a50213b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/util/knative/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
v1 "k8s.io/api/core/v1"
)

var uriRegexp = regexp.MustCompile(`^knative:[/]*(channel|endpoint|event)(?:$|/([A-Za-z0-9.-]+)(?:[/?].*|$))`)
var uriRegexp = regexp.MustCompile(`^knative:[/]*(channel|endpoint|event)(?:[?].*|$|/([A-Za-z0-9.-]+)(?:[/?].*|$))`)
var plainNameRegexp = regexp.MustCompile(`^[A-Za-z0-9.-]+$`)

const (
Expand Down
8 changes: 8 additions & 0 deletions pkg/util/knative/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ func TestChannelUri(t *testing.T) {
Name: "default",
Kind: "Broker",
}, ref)

ref, err = ExtractObjectReference("knative://event?&brokerApiVersion=eventing.knative.dev/v1beta13&brokxerName=broker2")
assert.Nil(t, err)
assert.Equal(t, v1.ObjectReference{
APIVersion: "eventing.knative.dev/v1beta13",
Name: "default",
Kind: "Broker",
}, ref)
}

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

0 comments on commit a50213b

Please sign in to comment.