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

Saurabh Parkhi commented on IO-890:
-----------------------------------

Thanks [~ggregory] 

My concern is, the method is not returning the filename. You are right about 
the Javadoc where the details of the behaviour are mentioned, however, if you 
read the `return` statement in the javadoc, the method does not return filename 
in this particular case. As I mentioned before, since the file is operating on 
`String` instead of `Path` it's behaving this way. 

You are absolutely right that, it is rare.  When I wrote the test, I used the 
`File` object from Java to get the expected filename. I also tried making the 
same change in the implementation, however, I found that it interfered with 
other expectations of getName and getBaseName hence I've not proposed 
implementation changes. This sits in-line with your concern about it 
potentially breaking other applications. 

I'll be able to workaround this in my application, so I leave it to you to 
decide whether to keep this bug open or close it. 

Many thanks, 

> FilenameUtils.getName(String)  doesn't return full name if the filename 
> contains a separator character
> ------------------------------------------------------------------------------------------------------
>
>                 Key: IO-890
>                 URL: https://issues.apache.org/jira/browse/IO-890
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Saurabh Parkhi
>            Priority: Minor
>
> Tried and Replicated on Linux
>  * Create a file with backslash in the name e.g. `touch 
> file'\'withbackslash.txt` 
>  * try to get the filename from the full path, it splits on the last 
> separator returning only part of the file name
>  
> As the method operates only on String, it fails, if it generates a File or 
> Path object and get the filename, it will work



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

Reply via email to