ForkHub icon indicating copy to clipboard operation
ForkHub copied to clipboard

Support image upload

Open sedrubal opened this issue 9 years ago • 3 comments

Support upload of images when writing new issues.

sedrubal avatar Jun 09 '15 10:06 sedrubal

This would be a very nice feature to have. I'd be willing to contribute code/time/effort to implement it, but I can't seem to find an officially-documented GitHub API for doing so. It's entirely possible I've overlooked the API endpoint, but I did search around for at least fifteen minutes or so. :stuck_out_tongue:

Obviously this is technically possible. The text box I'm using to type this comment has a hint attached to the bottom of it that reads,

Attach files by dragging & dropping, Choose Files selecting them, or pasting from the clipboard.

The upload method it uses (the current browser version of GitHub) calls out to a few undocumented endpoints, making a couple PUT/POST requests to get everything in order. I'd rather not attempt to use this method for uploading, because, well, you know. Using undocumented features is a really good way for things to break without warning.

I'm afraid I don't really know how to proceed from here, anyone have any thoughts?

t-richards avatar Dec 05 '15 23:12 t-richards

The upload method it uses (the current browser version of GitHub) calls out to a few undocumented endpoints, making a couple PUT/POST requests to get everything in order. I'd rather not attempt to use this method for uploading, because, well, you know. Using undocumented features is a really good way for things to break without warning.

I actually think that's our best option. I've been doing a few tests and it seams we simply need to send a POST request to https://github.com/upload/policies/assets and get the final URL of the image from the response.

I agree that this might change without prior notice, so it might be a good idea to contact Github and ask them how stable this API really is.

jonan avatar Dec 11 '15 10:12 jonan

@jonan do you know if sending a POST request to https://github.com/upload/policies/assets still works and if so do you happen to have a working example by any chance?

LukePrior avatar May 22 '22 13:05 LukePrior