This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.14.x by this push:
new fbf92c8dc7b CAMEL-22471: camel-jbang - Send command with file location
should use absolute path
fbf92c8dc7b is described below
commit fbf92c8dc7bf8752cc00b0a3115356a982bbfb58
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Sep 30 13:51:05 2025 +0200
CAMEL-22471: camel-jbang - Send command with file location should use
absolute path
---
.../camel/dsl/jbang/core/commands/action/CamelSendAction.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
index e31111ce30c..6650f17f955 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
@@ -148,6 +148,14 @@ public class CamelSendAction extends ActionBaseCommand {
String mep = (reply || replyFile != null) ? "InOut" : "InOnly";
root.put("exchangePattern", mep);
if (body != null) {
+ // favour using absolute path to file as the send command can be
called from another
+ // folder than where camel is running
+ if (body.startsWith("file:")) {
+ File f = new File(body.substring(5));
+ if (f.exists() && f.isFile()) {
+ body = "file:" + f.getAbsolutePath();
+ }
+ }
root.put("body", body);
}
if (headers != null) {