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

Rupinder S. Gill commented on CAMEL-16663:
------------------------------------------

The problem is in GenericFileConsumer.isMatched():

 
{code:java}
        if (excludeExt != null) {
            String ext = FileUtil.onlyExt(file.getFileName());
            for (String exclude : excludeExt) {
                if (exclude.equalsIgnoreCase(ext)) {
                    return false;
                }
            }
        }
{code}
FileUtil.onlyExt("foo.bar.filepart") returns "bar.filepart".

 

Changing to FileUtil.onlyExt("foo.bar.filepart",true) would return "filepart" 
and that would fix the issue... but then something like "excludeExt=tar.gz" 
won't work.

Something like the following should do the trick:
{code:java}
        if (excludeExt != null) {
            String filename = file.getFileName().toLowerCase();
            for (String exclude : excludeExt) {
                if (filename.endsWith("." + exclude.toLowerCase()) {  // todo: 
lower-case items when excludeExt list is initialized
                    return false;
                }
            }
        }
{code}
 

> camel-file - excludeExt does not work if file has multiple extensions
> ---------------------------------------------------------------------
>
>                 Key: CAMEL-16663
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16663
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 3.10.0
>            Reporter: Rupinder S. Gill
>            Priority: Minor
>
> Option set to "excludeExt=filepart", but file "foo.bar.filepart" still gets 
> picked up.
> Current workaraund is to use "antExclude=*.filepart".
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to