[
https://issues.apache.org/jira/browse/IO-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16506242#comment-16506242
]
Ohad R commented on IO-579:
---------------------------
thanks [~garydgregory] for your supoer-quick reply.
In my case, I have an extension (the param) "jpg". On the file-system (windows
in my case), there is a file "something.JPG". Due to the way the method is
implemented now, I have to pass 2 extensions - "jpg" and "JPG", not to mention
all other permutations (jPg, JPg, etc). otherwise, the method isExtension()
returns false, and it is wrong...
I think the right way is to allow (by a param) the caller to decide whether he
wants to check case-sensitive or not.... and it should be very easy fix,
because there is already the method FilenameUtils.equals()....
what do you think?
> FilenameUtils.isExtension() is case-sensitive
> ---------------------------------------------
>
> Key: IO-579
> URL: https://issues.apache.org/jira/browse/IO-579
> Project: Commons IO
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 2.6
> Reporter: Ohad R
> Priority: Major
> Labels: easyfix
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> FilenameUtils.isExtension() is case-sensitive.
> All 3 implementations of this method call String.equals() rather than
> equalsIgnoreCase(), so it means that if my extension is "jpg", for example,
> and my filename is something.JPG, the method (any of them) will return
> 'false'.
>
> fix suggestion: should use the method
> [FilenameUtils.eqauls(...)|https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/FilenameUtils.java#L1200]
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)