Skip to content

Commit

Permalink
[FIXED JENKINS-13400] Handle file:///path URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Glick committed Apr 30, 2012
1 parent 64bf842 commit 6c5a04e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/hudson/plugins/mercurial/HgExe.java
Expand Up @@ -39,6 +39,7 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -255,7 +256,7 @@ static boolean pathEquals(@NonNull String pathURL, @NonNull String pathAsInConfi
if (pathAsInConfig.equals(pathURL + '/')) {
return true;
}
if (pathURL.startsWith("file:/") && new File(pathAsInConfig).toURI().toString().equals(pathURL)) {
if (pathURL.startsWith("file:/") && URI.create(pathURL).equals(new File(pathAsInConfig).toURI())) {
return true;
}
return false;
Expand Down
1 change: 1 addition & 0 deletions src/test/java/hudson/plugins/mercurial/HgExeTest.java
Expand Up @@ -36,6 +36,7 @@ public class HgExeTest {
assertTrue(HgExe.pathEquals("http://nowhere.net/hg", "http://nowhere.net/hg"));
assertFalse(HgExe.pathEquals("https://nowhere.net/hg/", "http://nowhere.net/hg/"));
assertTrue(HgExe.pathEquals("file:/var/hg/stuff", "/var/hg/stuff"));
assertTrue(HgExe.pathEquals("file:///var/hg/stuff", "/var/hg/stuff"));
assertFalse(HgExe.pathEquals("file:/var/hg/stuff", "/var/hg/other"));
}

Expand Down

0 comments on commit 6c5a04e

Please sign in to comment.