I am trying to create a file using the GitHub API . The file must contain one byte 0xDD . I use the following command:
http PUT https://api.github.com/repos/koluch/test/contents/data.txt "message"="New file" "content"="3Q==" Authorization:"token <OAUTH_TOKEN>"
3Q== is a Base64 representation of the 0xDD byte. This query returns 200 ; however, when I try to get the file using a GET request ...
http GET https://api.github.com/repos/koluch/test/contents/data.txt
... it returns the following JSON:
{ "_links": { "git": "https://api.github.com/repos/koluch/test/git/blobs/4e3bc519eef7d5a35fff67687eaee65616832e45", "html": "https://github.com/koluch/test/blob/master/data.txt", "self": "https://api.github.com/repos/koluch/test/contents/data.txt?ref=master" }, "content": "77+9\n", "download_url": "https://raw.githubusercontent.com/koluch/test/master/data.txt", "encoding": "base64", "git_url": "https://api.github.com/repos/koluch/test/git/blobs/4e3bc519eef7d5a35fff67687eaee65616832e45", "html_url": "https://github.com/koluch/test/blob/master/data.txt", "name": "data.txt", "path": "data.txt", "sha": "4e3bc519eef7d5a35fff67687eaee65616832e45", "size": 1, "type": "file", "url": "https://api.github.com/repos/koluch/test/contents/data.txt?ref=master" }
The content field contains the value 77+9\n , which is not my 0xDD byte. When I use the download url, everything is fine.
Does anyone know what is going on?
source share