Fixed url generated by pull request/compare button

The `:` character was getting escaped leading to an ugly url. This is
different from the urls generated when editing the branches in a pull
request. In that case the url did not have `:` escaped.
This commit is contained in:
Boris Bera
2015-07-03 21:23:53 -04:00
parent fd4fe0dc0d
commit f1d2a71b49
3 changed files with 22 additions and 2 deletions

View File

@@ -34,4 +34,18 @@ class HelpersSpec extends Specification {
helpers.repositoryDefaultCompareOrigin(repo) mustEqual "parent-user:some-branch"
}
}
"encodeCompareBranch" should {
"not uri encode /" in {
helpers.encodeCompareBranch("foo/bar#baz") mustEqual "foo/bar%23baz"
}
"not uri encode :" in {
helpers.encodeCompareBranch("foo:bar#baz") mustEqual "foo:bar%23baz"
}
"uri encode special characters" in {
helpers.encodeCompareBranch("!#$&'()+,;=?@[]") mustEqual "%21%23%24%26%27%28%29%2B%2C%3B%3D%3F%40%5B%5D"
}
}
}