Skip to content

Commit

Permalink
[JENKINS-26762] notifyCommit: ignore trailing forward slashes when co…
Browse files Browse the repository at this point in the history
…mparing URLs
  • Loading branch information
StevenGBrown committed Apr 5, 2017
1 parent 3b35fbc commit 9dbcc97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -72,7 +72,7 @@ static boolean looselyMatches(URI notifyUri, String repository) {
if (!isUnexpandedEnvVar(repository)) {
URI repositoryUri = new URI(repository);
result = Objects.equal(notifyUri.getHost(), repositoryUri.getHost())
&& Objects.equal(notifyUri.getPath(), repositoryUri.getPath())
&& Objects.equal(StringUtils.stripEnd(notifyUri.getPath(), "/"), StringUtils.stripEnd(repositoryUri.getPath(), "/"))
&& Objects.equal(notifyUri.getQuery(), repositoryUri.getQuery());
}
} catch ( URISyntaxException ex ) {
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/hudson/plugins/mercurial/MercurialStatusTest.java
Expand Up @@ -35,18 +35,18 @@
public class MercurialStatusTest {

@Test public void testLooselyMatches() throws URISyntaxException {
assertTrue( MercurialStatus.looselyMatches(new URI("ssh://somehost/"), "ssh://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost/"), "http://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("ssh://somehost/"), "ssh://somehost"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost"), "http://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost:80/"), "http://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost/"), "http://somehost:80/"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost:443/"), "https://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost"), "http://somehost:80/"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost:443"), "https://somehost/"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/"), "https://somehost:443/"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost:443/"), "https://somehost:443/"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost/jenkins"), "http://somehost/jenkins"));
assertTrue( MercurialStatus.looselyMatches(new URI("http://somehost:80/jenkins"), "http://somehost:80/jenkins"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins"), "https://somehost/jenkins"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins?query=true"), "https://somehost/jenkins?query=true"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins?query=some%20path"), "https://somehost/jenkins?query=some%20path"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins/?query=some%20path"), "https://somehost/jenkins?query=some%20path"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins"), "https://user@somehost/jenkins"));
assertTrue( MercurialStatus.looselyMatches(new URI("https://somehost/jenkins"), "https://user:password@somehost/jenkins"));
assertTrue( MercurialStatus.looselyMatches(new URI("ssh://somehost/path"), "ssh://user:password@somehost:22/path"));
Expand Down

0 comments on commit 9dbcc97

Please sign in to comment.