This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.8.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.8.x by this push:
     new f14aff82665 CAMEL-21240: camel-jbang - Download does not work with 
--source-dir option
f14aff82665 is described below

commit f14aff82665f3fd9f4fc439f97cc99f685632cd0
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Sep 19 07:13:30 2024 +0200

    CAMEL-21240: camel-jbang - Download does not work with --source-dir option
---
 .../apache/camel/component/platform/http/main/MainHttpServer.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
index 5a57c98a440..4974e06bd36 100644
--- 
a/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
+++ 
b/components/camel-platform-http-main/src/main/java/org/apache/camel/component/platform/http/main/MainHttpServer.java
@@ -1165,9 +1165,13 @@ public class MainHttpServer extends ServiceSupport 
implements CamelContextAware,
                     ctx.response().setStatusCode(200);
                     ctx.end(sj.toString());
                 } else {
-                    // load file as resource
+                    // load file as resource (try both classpath and file)
                     ResourceLoader loader = 
PluginHelper.getResourceLoader(camelContext);
                     Resource res = loader.resolveResource("classpath:" + name);
+                    if (res == null || !res.exists()) {
+                        // attempt without path
+                        res = loader.resolveResource("classpath:" + 
FileUtil.stripPath(name));
+                    }
                     if (res == null || !res.exists()) {
                         for (org.apache.camel.Route route : 
camelContext.getRoutes()) {
                             String loc = route.getSourceLocation();

Reply via email to