question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create or Update file fails when content length > 57

See original GitHub issue

Describe 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:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bitwisemancommented, Dec 21, 2019

@asthinasthi I’ve submitted #650. Could you give it a try and make sure it works for you?

0reactions
asthinasthicommented, Dec 22, 2019

Works fine. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the "Content-Length" field in HTTP header?
It's the number of bytes of data in the body of the request or response. The body is the part that comes after...
Read more >
Desktop Client sync returns error: "Invalid Content-Length in ...
I try to reinstall owncloud server but nothing change. The issue is only while syncing. All reactions.
Read more >
Content length mismatch error with correct data feed file
I have only 1 data feed. If I upload it manually it gets uploaded with no errors, but when I set up automatic...
Read more >
ThingSpeak error responses broken? - MATLAB Answers
Diving deeper, i recognized that the header field "Content-Length" is missing. Even more, there is always status-code 200 present, ...
Read more >
Windows Update Servers returning Content-Length: 0 for ...
I think I'll try logging a bug with Microsoft and see where that gets me! – carveone. May 15, 2021 at 16:23. Add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found