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

Peter De Maeyer commented on IO-886:
------------------------------------

Fix is trivial, code is covered by existing tests. I made a PR (one-liner fix).

> PathUtils.RelativeSortedPaths.extractKey uses incorrect regular expression
> --------------------------------------------------------------------------
>
>                 Key: IO-886
>                 URL: https://issues.apache.org/jira/browse/IO-886
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.21.0
>            Reporter: Peter De Maeyer
>            Priority: Trivial
>         Attachments: image-2026-02-07-14-27-32-345.png
>
>
> {{PathUtils.RelativeSortedPaths.extractKey}} uses a regular expression with 
> an escape character to escape a single character separator, but separator is 
> a string so in theory can be multiple characters. IntelliJ gives an error on 
> this (the compiler doesn't).
> !image-2026-02-07-14-27-32-345.png!
> In practice, all file systems have single-character separators AFAIK, so it's 
> more a theoretical issue.
> I suggest to just remove the regular expression, there is no need for it. 
> Just use an exact string-matching replacement instead.



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

Reply via email to