gnodet commented on code in PR #393:
URL: https://github.com/apache/maven-filtering/pull/393#discussion_r4093686748


##########
src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java:
##########
@@ -56,7 +56,7 @@ public final class FilteringUtils {
      */
     private static final int FILE_COPY_BUFFER_SIZE = ONE_MB * 30;
 
-    private static final String WINDOWS_PATH_PATTERN = 
"^(.*)[a-zA-Z]:\\\\(.*)";
+    private static final String WINDOWS_PATH_PATTERN = 
"^(?:.*[a-zA-Z]:\\\\|[^:]+\\\\).*";

Review Comment:
   Fixed in 3947f59.



##########
src/test/java/org/apache/maven/shared/filtering/FilteringUtilsTest.java:
##########
@@ -113,6 +113,17 @@ void escapeWindowsPathStartingWithDrive() {
         assertEquals("C:\\\\Users\\\\Administrator", 
FilteringUtils.escapeWindowsPath("C:\\Users\\Administrator"));
     }
 
+    @Test
+    void escapeWindowsPathRelative() {
+        assertEquals("src\\\\main\\\\java", 
FilteringUtils.escapeWindowsPath("src\\main\\java"));
+    }
+
+    @Test
+    void escapeWindowsPathPreservesRepeatedBackslashes() {
+        // Already-escaped backslash pairs (\\) are preserved as-is 
(idempotent guard)
+        assertEquals("C:\\\\Users", 
FilteringUtils.escapeWindowsPath("C:\\\\Users"));
+    }
+
     @Test
     void escapeWindowsPathMissingDriveLetter() {
         assertEquals(":\\Users\\Administrator", 
FilteringUtils.escapeWindowsPath(":\\Users\\Administrator"));

Review Comment:
   Fixed in 3947f59.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to