Create or Update file fails when content length > 57
See original GitHub issueDescribe the bug When we invoke commit() with content length > 57
The API fails with 422, invalid Base 64 encoding
If we have a content 1234567890123456789012345678901234567890123456789012345678
of length 58.
Base64 encoding is
MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3OA==
MIME encoding looks like
MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3
OA==
MIME encoding breaks the string into chunks of 76. This is rejected by Github API
This could be due to the recent change ? https://github.com/github-api/github-api/blob/d1507f26668950508e0bf242c34cdb599003991a/src/main/java/org/kohsuke/github/GHContentBuilder.java#L71 To Reproduce Steps to reproduce the behavior: Invoke the method with content of length >57
Expected behavior The commit must be successful
Desktop (please complete the following information): 1.102-SNAPSHOT
Additional context
I was able to fix this issue locally by using Base64.getEncoder().encodeToString()
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
@asthinasthi I’ve submitted #650. Could you give it a try and make sure it works for you?
Works fine. Thanks!