Skip to content
Permalink
Browse files

[FIXED JENKINS-12544] Illegal directory name on Windows when port num…

…ber used in URL.
  • Loading branch information...
Jesse Glick
Jesse Glick committed May 1, 2012
1 parent 56cba93 commit fd76cf11527760b2f880ee81ee76a23d1b083079
@@ -174,7 +174,7 @@ static String hashSource(String source) {
if (!source.endsWith("/")) {
source += "/";
}
Matcher m = Pattern.compile(".+[/]([^/]+)[/]?").matcher(source);
Matcher m = Pattern.compile(".+[/]([^/:]+)(:\\d+)?[/]?").matcher(source);
BigInteger hash;
try {
hash = new BigInteger(1, MessageDigest.getInstance("SHA-1").digest(source.getBytes("UTF-8")));
@@ -1,6 +1,7 @@
package hudson.plugins.mercurial;

import junit.framework.TestCase;
import org.jvnet.hudson.test.Bug;

public class CacheTest extends TestCase {

@@ -15,4 +16,9 @@ public void testHashSource() throws Exception {
assertEquals("210ED9E2610F74A473985D8D9EF4483D5D30265E-project", Cache.hashSource("ssh://dudette@math.utexas.edu/some/project/"));
}

@Bug(12544)
public void testHashSource2() throws Exception {
assertEquals("DA7E6A4632009859A61A551999EE2109EBB69267-ronaldradial", Cache.hashSource("http://ronaldradial:8000/"));
}

}

0 comments on commit fd76cf1

Please sign in to comment.
You can’t perform that action at this time.