Skip to content

Conan registry: project-level Conan API `download_urls` returns broken URLs

Summary

The issue is in project-level Conan API. Requesting download_urls using Conan API gives URLs that are missing projects/<id> part. Getting files using returned URLs leads to 404 error. And as a result, Conan commands (e.g. conan install) fail with a message like ERROR: <package> was not found in remote '<remote>'.

After manual insertion of projects/<id> to the appropriate part of the URL, API responds with the file content without any problems.

Steps to reproduce

curl -H "Authorization: Bearer <token>" https://gitlab.example.com/api/v4/projects/<id>/packages/conan/v1/conans/<package>/<version>/<user>/<channel>/download_urls

returns the following information

{
"conan_sources.tgz":"https://gitlab.example.com/api/v4/packages/conan/v1/files/<package>/<version>/<user>/<channel>/0/export/conan_sources.tgz",
"conanfile.py":"https://gitlab.example.com/api/v4/packages/conan/v1/files/<package>/<version>/<user>/<channel>/0/export/conanfile.py",
"conanmanifest.txt":"https://gitlab.example.com/api/v4/packages/conan/v1/files/<package>/<version>/<user>/<channel>/0/export/conanmanifest.txt"
}

Example Project

What is the current bug behavior?

The prefix of URLs is https://gitlab.example.com/api/v4/packages/conan/v1/files

What is the expected correct behavior?

The prefix of URLs is https://gitlab.example.com/api/v4/projects/<id>/packages/conan/v1/files

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:		Ubuntu 18.04
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.9
Git Version:	2.28.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.4.4
Revision:	e7d9e8b4224
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.9
URL:		https://gitlab.example.com
HTTP Clone URL:	https://gitlab.example.com/some-group/some-project.git
SSH Clone URL:	git@gitlab.example.com:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.7.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.7.0 ? ... OK (13.7.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/2 ... yes 3/3 ... yes 11/4 ... yes 11/5 ... yes 11/6 ... yes 11/7 ... yes 11/8 ... yes 11/9 ... yes 11/10 ... yes 11/12 ... yes 34/13 ... yes 34/14 ... yes 11/15 ... yes 14/16 ... yes 6/17 ... yes 16/18 ... yes 12/19 ... yes 11/20 ... yes 12/21 ... yes 11/22 ... yes 11/23 ... yes 8/24 ... yes 12/26 ... yes 11/27 ... yes 11/28 ... yes 11/29 ... yes 11/30 ... yes 11/31 ... yes 11/32 ... yes 11/33 ... yes 8/34 ... yes 29/35 ... yes 29/36 ... yes 11/37 ... yes 17/38 ... yes 17/39 ... yes 2/40 ... yes 17/41 ... yes 11/43 ... yes 2/44 ... yes 11/45 ... yes 11/46 ... yes 11/47 ... yes 34/49 ... yes 2/50 ... yes 8/51 ... yes 37/52 ... yes 38/53 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.6) Git version >= 2.24.0 ? ... yes (2.28.0) Git user has default SSH configuration? ... yes Active users: ... 15 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by Yurii Skatarenko