megasanjay/upload-to-zenodo

Upload failed due to wrong `content_type`

Closed this issue ยท 4 comments

While using this action, I always result in the error Invalid 'Content-Type' header. It seems that the content type application/zip is not supported anymore and that all uploads expect the content type application/octet-stream.

Log:

Preparing CiteTest-0.0.14.zip upload...
File name: CiteTest-0.0.14.zip
File path: /home/runner/work/CiteTest/CiteTest/release-assets/CiteTest-0.0.14.zip
Uploading file CiteTest-0.0.14.zip to https://zenodo.org/api/files/XX9b7bc1-d21c-4a00-8829-069984b5e0XX/CiteTest-0.0.14.zip
Error: Error with zenodo upload: Invalid 'Content-Type' header. Expected one of: application/octet-stream
Error: Could not upload file to Zenodo.
Error: Could not upload file to Zenodo. Error
Deleting Zenodo deposition 138700XX

I saw the code comments here:

if (content_type.includes('application/json')) {
/**
* zenodo declines json uploads with a 400 - BAD REQUEST,
* avoiding error by setting content type to plain text
*
* @see https://github.com/zenodraft/zenodraft/blob/main/src/lib/file/add.ts#L15-L18
* */
content_type = 'text/plain';
}

If I check the referred repository, they changed these lines of code 9 month ago and now always use application/octet-stream. The changes can be found in commit 8e38853. Also look into the current code snippet.

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.

@megasanjay could you please take a look at the PR that would solve this issue #55?

@megasanjay we tested the action now in our repo using the main branch, but still get the same error. I still had some to dos left on my PR (#55) including the build step that yielded some weird results for me.
Can you take a look what might be the problem here?