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

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 65573d8873 Fix MailTest.testAttachments test on Windows
65573d8873 is described below

commit 65573d88732ebb25173f887ab31a2c1e068a258d
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Wed Nov 22 09:50:58 2023 +0000

    Fix MailTest.testAttachments test on Windows
    
    Fixes #5536
---
 .../java/org/apache/camel/quarkus/component/mail/CamelResource.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
 
b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
index 6da11d7f74..206859c65c 100644
--- 
a/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
+++ 
b/integration-tests/mail/src/main/java/org/apache/camel/quarkus/component/mail/CamelResource.java
@@ -18,6 +18,8 @@ package org.apache.camel.quarkus.component.mail;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;
@@ -102,7 +104,7 @@ public class CamelResource {
             AttachmentMessage in = 
exchange.getMessage(AttachmentMessage.class);
 
             DefaultAttachment attachment;
-            if (fileName.startsWith("/")) {
+            if (Files.exists(Paths.get(fileName))) {
                 attachment = new DefaultAttachment(new 
FileDataSource(fileName));
             } else {
                 attachment = new DefaultAttachment(

Reply via email to