You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a tree with one of the blobs is "base64" encoded? #1293
And to add a bit context to why I run into this issue, I was trying to create a commit which contains ".jar" files, and found out that reading the .jar files into bytes (using ioutiles.Readfile()) and then convert to string and put it into a TreeEntry - this actually messes up the .jar files content when it gets uploaded to my github repo (maybe I am doing something apparently wrong?).
I've read through the documentation at the link you have provided, and it is not obvious to me how to upload binary data like you wish to do via the GitHub API.
Can you please send an email to [email protected] and ask them how to send binary data via this API, then report back here with the response?
Thanks @gmlewis for the prompt response! Yes I also didn't find documents mentioned about this but assuming it should be able to do so that's why I have been trying different approaches. I will send an email to [email protected] and post the answer back once I got it.
Just a quick update, I have sent out an email to [email protected] and in the meantime I've tried the following and it works for my .jar files:
for each .jar file, read into bytes and then base64 encode.
Call CreateBlob() API with the base64 encoded content and encoding "base64", getting back a Blob* which contains the SHA.
Create a TreeEntry and set the TreeEntry's SHA to the newly created blob SHA.
Create a new commit based on all the new TreeEntry's.
The above works. But as it shows, you will need to create individual new blobs for your binary files, and then use their SHA in the tree entries to create the commit. Ideally I think the TreeEntry should have a "Encoding" (just like Blob type does) field and automatically does that.
If you come up with a good API to support doing this as a method in this repo, feel free to submit a PR and we can consider adding it. I would think that you can make the base64 encoding optional and the default would be to just send the utf-8 contents unmodified as a string.
@gauntface will also need to sign off on this new API and PR, so I'll mention him here so he has a heads-up on what might be coming. 😄
Hi, I was wondering if anyone is actively working on this issue. I'm looking for somewhere I can contribute, so if I can help out somehow with this please let me know. Thanks.
If you are just starting out, this issue is rather complex and I would not recommend it.
This is a specific challenge that @zhuzeng had and since there have been no other comments on the issue, we'll probably give this one a little more time but then close it due to inactivity.
Feel free to peruse the other issues, and check out our CONTRIBUTING.md guide for getting started. Thank you for your interest!
Sorry @gmlewis that I didn't really get time to make the PR, and as you mentioned this issue is rather complex. Since I opened this issue at the first place, and I have a workaround, I will close this issue for now.
Activity
gmlewis commentedon Oct 3, 2019
I've read through the documentation at the link you have provided, and it is not obvious to me how to upload binary data like you wish to do via the GitHub API.
Can you please send an email to
[email protected]and ask them how to send binary data via this API, then report back here with the response?Thank you, @zhuzeng!
zhuzeng commentedon Oct 3, 2019
Thanks @gmlewis for the prompt response! Yes I also didn't find documents mentioned about this but assuming it should be able to do so that's why I have been trying different approaches. I will send an email to [email protected] and post the answer back once I got it.
zhuzeng commentedon Oct 3, 2019
Just a quick update, I have sent out an email to [email protected] and in the meantime I've tried the following and it works for my .jar files:
The above works. But as it shows, you will need to create individual new blobs for your binary files, and then use their SHA in the tree entries to create the commit. Ideally I think the TreeEntry should have a "Encoding" (just like Blob type does) field and automatically does that.
gmlewis commentedon Oct 3, 2019
Excellent! I'm glad you got it to work, @zhuzeng!
If you come up with a good API to support doing this as a method in this repo, feel free to submit a PR and we can consider adding it. I would think that you can make the base64 encoding optional and the default would be to just send the utf-8 contents unmodified as a string.
@gauntface will also need to sign off on this new API and PR, so I'll mention him here so he has a heads-up on what might be coming. 😄
zhuzeng commentedon Oct 4, 2019
Thanks @gmlewis . I will try to make a PR when I get time :)
ajz01 commentedon Mar 14, 2020
Hi, I was wondering if anyone is actively working on this issue. I'm looking for somewhere I can contribute, so if I can help out somehow with this please let me know. Thanks.
gmlewis commentedon Mar 14, 2020
If you are just starting out, this issue is rather complex and I would not recommend it.
This is a specific challenge that @zhuzeng had and since there have been no other comments on the issue, we'll probably give this one a little more time but then close it due to inactivity.
Feel free to peruse the other issues, and check out our CONTRIBUTING.md guide for getting started. Thank you for your interest!
ajz01 commentedon Mar 14, 2020
Yeah I thought this might be complicated. I'll check out the guide and also keep checking back for recommended "new contributor" issues. Thanks.
zhuzeng commentedon Jul 4, 2020
Sorry @gmlewis that I didn't really get time to make the PR, and as you mentioned this issue is rather complex. Since I opened this issue at the first place, and I have a workaround, I will close this issue for now.
Mrgaton commentedon Jan 22, 2024
Can we fix it now?