Content type not allowed for debian, publishing debian package to repo

I’ve been struggling hard to publish a debian package to my project repo. After creating the distribution, I’ve tried publishing my package with the following command:

curl --request PUT --header 'PRIVATE-TOKEN:$DEB_PUB_TOKEN' --header 'Content-Type:application/vnd.debian.binary-package;charset=binary' --upload-file '<MYDEB>.deb' 'https://gitlab.<example>.com/api/v4/projects/493/packages/debian?distribution=sid&component=main'

I get back the error:
{"error":"The provided content-type 'application/vnd.debian.binary-package' is not supported."}

How am I supposed to upload the debian if the mime-type is not allowed?

Not sure how to proceed

Edit:
Extra detail:

  • The debian API is enabled

Hi,

According to here: Debian packages in the package registry | GitLab Debian support is still a work in progress and requires functionality to be enabled first, using commands like below:

Feature.enable(:debian_packages)

you didn’t mention if you have done any of what was suggested in the link or not, so just pointing it out, just in case this hasn’t been done.

You’re right, I forgot to mention it.
It is enabled, if it weren’t I’d get error 404/403 (I’ve also been there).

The command in the docs I linked for uploading a package is different to yours though:

curl --request PUT --user "<username>:<personal_access_token>" \
  --get --data "distribution=sid" --data "component=main" \
  "https://gitlab.example.com/api/v4/projects/<project_id>/packages/debian/" \
  --upload-file  /path/to/your.deb

It doesn’t specify the content type like you have done. Perhaps try without that.

That command in particular is wrong:

  • The request type is specified is PUT, but the --get flag sets it back to GET, which throws an error
  • Uploading the file as is (with everything else correct) throws: {"error":"The provided content-type '' is not supported."}

The user part I have not tried yet, I’ll give it a try

Edit: same thing, no progress

Edit 2:
Adding --data also triggers the same issue as --get (–data makes it a POST request)

You may wish to take a look at this issue epic: Make the Debian repository generally available (GA) (&6057) · Epics · GitLab.org · GitLab mainly because this as mentioned in the docs is still experimental and most likely why things still don’t work right. That’s not including the security risks of enabling that option (mentioned in the Gitlab docs). I expect it would be good to report an issue within the linked Epic so that Gitlab devs can look at the problem and fix the mime type issue.

2 Likes

That’s great advice I’ll try it, thank you very much :slight_smile:

1 Like