You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2026/02/14 13:49:00 UTC

[jira] [Resolved] (IO-886) PathUtils.RelativeSortedPaths.extractKey uses incorrect regular expression

     [ https://issues.apache.org/jira/browse/IO-886?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved IO-886.
--------------------------------
    Fix Version/s: 2.22.0
       Resolution: Fixed

Fixed in git master and snapshot builds in [https://repository.apache.org/content/repositories/snapshots/commons-io/commons-io/2.22.0-SNAPSHOT]

 

> 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
>             Fix For: 2.22.0
>
>         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)