Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 1b40253

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 983c871 + f8fba41 commit 1b40253

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/main/java/org/kohsuke/github/GHContent.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,19 @@ protected void wrapUp(GHContent[] page) {
129129
}
130130

131131
public GHContentUpdateResponse update(String newContent, String commitMessage) throws IOException {
132-
return update(newContent, commitMessage, null);
132+
return update(newContent.getBytes(), commitMessage, null);
133133
}
134134

135135
public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException {
136-
String encodedContent = DatatypeConverter.printBase64Binary(newContent.getBytes());
136+
return update(newContent.getBytes(), commitMessage, branch);
137+
}
138+
139+
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage) throws IOException {
140+
return update(newContentBytes, commitMessage, null);
141+
}
142+
143+
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException {
144+
String encodedContent = DatatypeConverter.printBase64Binary(newContentBytes);
137145

138146
Requester requester = new Requester(owner.root)
139147
.with("path", path)

src/main/java/org/kohsuke/github/GHRepository.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,22 @@ public GHContent getReadme() throws Exception {
969969
}
970970

971971
public GHContentUpdateResponse createContent(String content, String commitMessage, String path) throws IOException {
972-
return createContent(content, commitMessage, path, null);
972+
return createContent(content.getBytes(), commitMessage, path, null);
973973
}
974974

975975
public GHContentUpdateResponse createContent(String content, String commitMessage, String path, String branch) throws IOException {
976+
return createContent(content.getBytes(), commitMessage, path, branch);
977+
}
978+
979+
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path) throws IOException {
980+
return createContent(contentBytes, commitMessage, path, null);
981+
}
982+
983+
public GHContentUpdateResponse createContent(byte[] contentBytes, String commitMessage, String path, String branch) throws IOException {
976984
Requester requester = new Requester(root)
977985
.with("path", path)
978986
.with("message", commitMessage)
979-
.with("content", DatatypeConverter.printBase64Binary(content.getBytes()))
987+
.with("content", DatatypeConverter.printBase64Binary(contentBytes))
980988
.method("PUT");
981989

982990
if (branch != null) {

0 commit comments

Comments
 (0)