You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Huang (Jira)" <ji...@apache.org> on 2021/06/23 01:36:00 UTC

[jira] [Created] (CAMEL-16745) excludeExt/includeExt not getting the right filename extension

Huang created CAMEL-16745:
-----------------------------

             Summary: excludeExt/includeExt not getting the right filename extension
                 Key: CAMEL-16745
                 URL: https://issues.apache.org/jira/browse/CAMEL-16745
             Project: Camel
          Issue Type: Improvement
          Components: camel-ftp
    Affects Versions: 3.10.0
            Reporter: Huang
             Fix For: Future


When I use includeExt=zip to filter files in FTP component, it not worked as I expected.

If I have a file named aaa.bbb.ccc.zip, it will get "bbb.ccc.zip" as the extension, which I expected was "zip".

From the code of GenericFileConsumer<T>.isMatched in camel-file I found that

 
{code:java}
if (includeExt != null) {
    String ext = FileUtil.onlyExt(file.getFileName());
    boolean any = false;
    for (String include : includeExt) {
        any |= include.equalsIgnoreCase(ext);
    }
   if (!any) {
        return false;
   }
}

{code}
May be we should change "String ext = FileUtil.onlyExt(file.getFileName());" to "String ext = FileUtil.onlyExt(file.getFileName(), true);"

 



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