Skip to content

Fix export upload

PMExtra requested to merge pm9551/gitlab:fix-export-upload into master

Summary

Fix Content-Type of project export upload request.

This is a little fix, please refer the file changes.

Details

I was trying to transform a GitLab Server to another and met a problem last week. I used Aliyun OSS (a cloud service like Amazon S3) to storage exported projects. I signed the urls for each project, but when I called the GitLab project export API, I got:

Project ***** couldn't be exported.

The errors we encountered were:

Error uploading the project. Code SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your key and signing method.

Then I tried to upload a file with same url by curl in shell, it was successful.

Then I spent many time on it, finally I found that GitLab send the upload request with Content-Type: application/x-www-form-urlencoded!

Snipaste_2020-05-08_18-57-29

Aliyun OSS was restrict the Content-Type with the signed url, so the signature does not match.

According the RFC6713, I think it should be application/gzip (also refer https://superuser.com/a/960710).

If you don't think so, I think application/octet-stream is also better than application/x-www-form-urlencoded in this case.

Merge request reports