You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/01 15:35:54 UTC

[I] Broken Windows path regex in FilteringUtils.getRelativeFilePath() [maven-filtering]

elharo opened a new issue, #352:
URL: https://github.com/apache/maven-filtering/issues/352

   In `src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java`, lines 184 and 187:
   
   ```
   if (toPath.matches("^\\\\\\[a-zA-Z]:")) {
       toPath = toPath.substring(1);
   }
   if (fromPath.matches("^\\\\\\[a-zA-Z]:")) {
       fromPath = fromPath.substring(1);
   }
   ```
   
   The regex `^\\\\[a-zA-Z]:` has a double-escaped backslash before the character class `[a-zA-Z]`, making `\\[` match a literal `[` character at the start. The intended regex is `^[a-zA-Z]:` — a drive letter followed by a colon at the start of the path. This regex will never match a Windows absolute path like `C:\\foo`, so the leading-slash stripping logic never executes. This is effectively dead code.
   
   On Windows this could cause incorrect normalization of paths like `/C:/foo` where the leading `/` should be stripped.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Broken Windows path regex in FilteringUtils.getRelativeFilePath() [maven-filtering]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed issue #352: Broken Windows path regex in FilteringUtils.getRelativeFilePath()
URL: https://github.com/apache/maven-filtering/issues/352


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org