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
502 Error Uploading Release Assets - Missing Mime Types #1097
Comments
By "the host" do you mean GitHub? For others tuning in, we are talking about: and this method: I notice that on line 358 we have: mediaType := mime.TypeByExtension(filepath.Ext(file.Name())) and I agree that it might be nice to be able to override the Your test case could help someone address this issue. Thanks for reporting this, @Jarlotee! This sounds like a good issue to address. |
The host meaning the server that is running your api. For example if I build from alpine linux I would not have a mime.types file available... |
Ah! I think I get it now. I was confused because this is technically a "client library" to the GitHub API. OK, so your "host" is a server running your own API that then uploads files (as a client) with various MIME types to the GitHub API. Gotcha. Please correct me if I'm wrong. So yes, this would be a good enhancement:
|
Sounds great, @aidenkeating - it is yours. Thank you. |
@gmlewis @Jarlotee Apologies for the delay on this. I've created #1102 to address the enhancements suggested in #1097 (comment). Mainly just allowing MediaType to be specified in UploadOptions. I could not reproduce the GitHub API rejecting the upload due to an invalid MIME type, even after ensuring all Wondering if the error/fix fix was coincidental and it was an issue on the GitHub side? Might be missing something in reproducing though? From reading https://developer.github.com/v3/repos/releases/#response-for-upstream-failure a 502 isn't guaranteed to be a MIME type issue, I'm not sure whether it makes sense to provide an improved/more specific error message unless the cause is guaranteed. wdyt? |
Thank you for digging into this and reporting back, @aidenkeating! It is greatly appreciated! @Jarlotee - can you please provide a simple test case with details on how to reproduce the problem? |
I think this can be closed, right? |
Yes |
If the host is missing mime types files (see Go Mime Documentation) the upload of assets will fail with a
502 Error creating policy []
The call to
UploadReleaseAsset
should return an error if no compatible mime type is found, because the error thrown by github is cryptic and unhelpful.Additionally it might be helpful to allow the user to specify the mime type.
The text was updated successfully, but these errors were encountered: