Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f3f39f

Browse files
authored
Merge pull request hub4j#1799 from SuperKael/release-upload-fix
Only try to strip upload url 'helpful garbage' if it is present
2 parents baf5c3b + a1499d7 commit 6f3f39f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ public GHAsset uploadAsset(String filename, InputStream stream, String contentTy
274274
Requester builder = owner.root().createRequest().method("POST");
275275
String url = getUploadUrl();
276276
// strip the helpful garbage from the url
277-
url = url.substring(0, url.indexOf('{'));
277+
int endIndex = url.indexOf('{');
278+
if (endIndex != -1) {
279+
url = url.substring(0, endIndex);
280+
}
278281
url += "?name=" + URLEncoder.encode(filename, "UTF-8");
279282
return builder.contentType(contentType).with(stream).withUrlPath(url).fetch(GHAsset.class).wrap(this);
280283
}

0 commit comments

Comments
 (0)