New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gist creation mangles binary files #2998
Comments
|
Since the gists API payload only accepts JSON, and I don't think it accepts base64-encoded files, I think that it's impossible to use the API to add or modify binary files. We should halt with a descriptive error when someone tries to upload a binary file, and when viewing a gist we should avoid printing binary content to stdout. |
|
It would be a nice addition for the API to accept base64-encoded files, but I believe that's outside the scope of this issue. In addition, |
|
@mislav I'd like to pick this up since it looks like no one is assigned. Could you assign this to me? |
|
@g14a Go right ahead! Thank you |
|
@mislav If a gist has multiple files and one of the files is a binary, and the user just tries to |
|
@g14a Let's render all non-binary files, and for binary files let's render the file header and a notice like “(Skipping rendering binary content)” If the user chose to view a specific file, and that file happens to be binary, the command should be aborted with an error such as “Error: file contents is binary”. |
|
got it thanks |


zambonin commentedFeb 18, 2021
•
edited
Describe the bug
Creating a Gist using the
ghcommand-line interface does not preserve thecontents of binary files.
Steps to reproduce the behavior
Create a Gist with a binary file using
gh gist create /path/to/binary-file.I have successfully reproduced this behaviour with JPG and PDF files.
Flags that you can pass to
gh gist createdo not matter, nor usinggh gist create -f test.foo < /path/to/binary-file.Expected vs actual behavior
The Gist is created successfully, but upon inspection, the binary file is not
correctly previewed and the raw contents are different.
Logs
I have added the expected file (my GitHub profile picture) to the created
Gist for easier inspection.
I'd wager that this is the offending line.
The text was updated successfully, but these errors were encountered: