Skip to content

Upload binary files to an existing release  #56

@AntonioFasano

Description

@AntonioFasano

I would like to a upload binary file to an existing release on GitHub, using the API published here.

developer.github.com/v3/repos/releases

Is it possible to upload a binary with a gh() POST?

In the meantime, I have tried with the R curl package. Assuming RELEASEID is the release ID to upload to, I might use:

library(curl)
h=new_handle()
handle_setheaders(h, Authorization="token XXXXX",
                               "Content-Type" = "application/x-dosexec",
                               "User-Agent" = "curl")

handle_setform(h, app=form_file("app.exe", "application/x-dosexec"))
url="https://uploads.github.com/repos/:OWNER/:REPO/releases/:RELEASEID/assets?name=app.exe"
curl_fetch_memory(url, handle=h)

The upload appears to succeed, but, when I download the file app.exe, it is corrupted.
I do not experience problems with other MIME types, e.g. PDFs.
Also, using curl.exe from the shell, app.exe does not break.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions