Merge pull request #299

This commit is contained in:
Kohsuke Kawaguchi
2016-10-24 19:15:46 -07:00

View File

@@ -765,6 +765,10 @@ public class GHRepository extends GHObject {
* invalid ref type being requested
*/
public GHRef getRef(String refName) throws IOException {
// hashes in branch names must be replaced with the url encoded equivalent or this call will fail
// FIXME: how about other URL unsafe characters, like space, @, : etc? do we need to be using URLEncoder.encode()?
// OTOH, '/' need no escaping
refName = refName.replaceAll("#", "%23");
return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", owner.login, name, refName), GHRef.class).wrap(root);
}
/**