Skip to content

Commit

Permalink
Store encoded content in class level variable on update.
Browse files Browse the repository at this point in the history
  • Loading branch information
farmdawgnation committed Nov 28, 2013
1 parent a56357f commit 9f3c5b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/kohsuke/github/GHContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ public GHContentUpdateResponse update(String newContent, String commitMessage) t
}

public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException {
String encodedContent = DatatypeConverter.printBase64Binary(newContent.getBytes());

Requester requester = new Requester(owner.root)
.with("path", path)
.with("message", commitMessage)
.with("sha", sha)
.with("content", DatatypeConverter.printBase64Binary(newContent.getBytes()))
.with("content", encodedContent)
.method("PUT");

if (branch != null) {
Expand All @@ -126,7 +128,7 @@ public GHContentUpdateResponse update(String newContent, String commitMessage, S
response.getContent().wrap(owner);
response.getCommit().wrapUp(owner);

this.content = newContent;
this.content = encodedContent;
return response;
}

Expand Down

0 comments on commit 9f3c5b9

Please sign in to comment.