Skip to content

Commit

Permalink
url encode hashes in ref names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Sheats committed Oct 21, 2016
1 parent df963cb commit 5334cb8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 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,8 @@ 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
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 5334cb8

Please sign in to comment.