Skip to content

Commit

Permalink
Merge pull request #299
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Oct 25, 2016
2 parents 87fbb8e + 4965fd5 commit 89aac45
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,10 @@ public GHRef[] getRefs(String refType) throws IOException {
* 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);
}
/**
Expand Down

0 comments on commit 89aac45

Please sign in to comment.