Skip to content

Commit

Permalink
Fix: Fail to run route with toD #4972
Browse files Browse the repository at this point in the history
Fix #4972
  • Loading branch information
claudio4j committed Dec 7, 2023
1 parent 3429c56 commit 279ae51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/util/camel/camel_runtime_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (c *RuntimeCatalog) IsResolvable(uri string) bool {
scheme = strings.SplitN(scheme, "?", 2)[0]
}

if strings.HasPrefix(scheme, "{{") && strings.HasSuffix(scheme, "}}") {
if strings.HasPrefix(scheme, "{{") && strings.Contains(scheme, "}}") {
// scheme is a property placeholder (e.g. {{url}}) which is not resolvable
return false
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/util/camel/camel_runtime_catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,19 @@ func TestIsResolvable(t *testing.T) {
uri string
expected bool
}{
// static dependencies
{desc: "Basic static dependency", uri: "log:info", expected: true},
{desc: "Basic static dependency with path and param", uri: "http://my-site/test?param=value", expected: true},
{desc: "Basic static dependency with path and param placeholder", uri: "http://my-site/test?{{params}}", expected: true},
{desc: "Basic static dependency with path placeholder and param", uri: "http://my-site/{{path}}?key=val", expected: true},

// placeholders
{desc: "Basic", uri: "{{url}}", expected: false},
{desc: "With query param placeholder", uri: "{{url}}?authMethod={{authMethod}}", expected: false},
{desc: "With query path and param placeholders 1", uri: "{{url}}/test?authMethod={{authMethod}}", expected: false},
{desc: "With query path and param placeholders 2", uri: "{{url}}/test?authMethod={{authMethod}}&key=val", expected: false},
{desc: "With query param", uri: "{{url}}?authMethod=Basic", expected: false},
{desc: "With query param and path", uri: "{{url}}/test", expected: false},
{desc: "With masked AND url-encoded query params", uri: "{{url}}?authMethod=%7B%7BauthMethod%7D%7D", expected: false},
}

Expand Down

0 comments on commit 279ae51

Please sign in to comment.