You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cl...@apache.org on 2023/12/11 20:41:35 UTC
(camel-k) branch main updated: Fix: Fail to run route with toD #4972 (#4976)
This is an automated email from the ASF dual-hosted git repository.
claudio4j pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 137b7ede7 Fix: Fail to run route with toD #4972 (#4976)
137b7ede7 is described below
commit 137b7ede7cb838f6f436cb634787d2ab7960dce3
Author: Claudio Miranda <cl...@claudius.com.br>
AuthorDate: Mon Dec 11 17:41:29 2023 -0300
Fix: Fail to run route with toD #4972 (#4976)
Fix https://github.com/apache/camel-k/issues/4972
---
pkg/util/camel/camel_runtime_catalog.go | 2 +-
pkg/util/camel/camel_runtime_catalog_test.go | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/pkg/util/camel/camel_runtime_catalog.go b/pkg/util/camel/camel_runtime_catalog.go
index b33b83800..00ed0101e 100644
--- a/pkg/util/camel/camel_runtime_catalog.go
+++ b/pkg/util/camel/camel_runtime_catalog.go
@@ -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
}
diff --git a/pkg/util/camel/camel_runtime_catalog_test.go b/pkg/util/camel/camel_runtime_catalog_test.go
index 796ee9341..02639a293 100644
--- a/pkg/util/camel/camel_runtime_catalog_test.go
+++ b/pkg/util/camel/camel_runtime_catalog_test.go
@@ -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},
}