You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Richard Vigniel (Jira)" <ji...@apache.org> on 2022/08/11 12:04:00 UTC

[jira] [Comment Edited] (CAMEL-18379) camel-mail: attachments with empty fileName

    [ https://issues.apache.org/jira/browse/CAMEL-18379?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17578438#comment-17578438 ] 

Richard Vigniel edited comment on CAMEL-18379 at 8/11/22 12:03 PM:
-------------------------------------------------------------------

current implementaton already skips if fileName is null, so I suggest having the same behavior when fileName is empty.

 

with more refactoring, the component could support attachments with no name, and multiple attachments with same name. but it would not fit with current camel Message interface, where attachments are named.  ( Map<String,Attachment> )


was (Author: rvigniel):
current implementaton already skips if fileName is null, so I suggest having the same behavior id fileName is empty.

 

with more refactoring, the component could support attachments with no name, and multiple attachments with same name. but it would not fit with current camel Message interface, where attachments are named.  ( Map<String,Attachment> )

> camel-mail: attachments with empty fileName
> -------------------------------------------
>
>                 Key: CAMEL-18379
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18379
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-mail
>    Affects Versions: 2.24.3, 3.18.0
>         Environment: camel 2.24.3 on karaf 4.2.7, openjdk 11.0.15
>            Reporter: Richard Vigniel
>            Priority: Minor
>             Fix For: 3.19.0
>
>         Attachments: test-camel-mail-inline.zip
>
>
> camel-mail cannot consume mails having attachment with empty fileName, for example :
> ------=_Part_16671_1906075314.1659698158276
> Content-Type: image/png; name=""
> Content-Disposition: inline; filename=""
> ...
>  
> this mail produces the following error:
> Caused by: java.lang.IllegalArgumentException: name must be specified and not empty
> at org.apache.camel.util.StringHelper.notEmpty(StringHelper.java:335) ~[!/:2.24.3]
> at org.apache.camel.component.mail.DelegatingDataSource.<init>(DelegatingDataSource.java:35) ~[!/:2.24.3]
> ...
> proposition: implement same behavior as attachment with no fileName, ie attachment is ignored.
>  
> workaround: use mapMailMessage=false option on camel source endpoint, so email is polled without error.
> then, in a Processor, on exchange object, overload binding class with custom "MailBinding" before reading attachments:
> exchange.setProperty(Exchange.BINDING,new NoInlineMailBinding());
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)