Copilot commented on code in PR #2224:
URL: https://github.com/apache/maven-resolver/pull/2224#discussion_r4459598407


##########
maven-resolver-api/src/test/java/org/eclipse/aether/repository/LocalRepositoryTest.java:
##########
@@ -49,4 +55,80 @@ void allSomePaths() {
     private void doIt(File file) {
         new LocalRepository(file.toPath().toUri().toASCIIString());
     }
+
+    /**
+     * Verifies that a plain Windows path string with an uppercase drive 
letter (e.g. {@code C:\Users\foo\repo})
+     * passed to {@link LocalRepository#LocalRepository(String)} preserves the 
drive letter and does not
+     * resolve against the JVM working directory. Previously, {@code 
RepositoryUriUtils.basedir()}
+     * treated the drive letter as a URL scheme and stripped it, producing a 
drive-relative path
+     * ({@code \Users\foo\repo}) that {@code new File(...).toURI()} then 
resolved against the JVM
+     * working directory — which can be on a different drive on Windows CI 
runners.
+     */
+    @Test
+    @EnabledOnOs(OS.WINDOWS)
+    void windowsPlainPathUppercaseDriveLetterPreserved() {
+        // Build the path from the system temp dir so it is always on a valid 
drive and avoids
+        // hardcoding a specific username or profile path (which may not exist 
on all runners).
+        Path tmpBase = Paths.get(System.getProperty("java.io.tmpdir"));
+        char driveLetter = 
Character.toUpperCase(tmpBase.getRoot().toString().charAt(0));

Review Comment:
   When the temporary directory and working directory use the same drive, this 
uppercase-drive test can pass even with the original drive-stripping bug. 
Select a drive different from the working-directory drive so the existing 
full-path assertion reliably detects the cross-drive regression. The target 
directory and drive do not need to exist.



-- 
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