Cannot fetch project by project path via API

Summary

/api/v4/projects/:id always returns a 404 Not found when using the project path for :id instead of the numeric project id. According to https://docs.gitlab.com/ee/api/projects.html#get-single-project it is possible to use the URL encoded project path to obtain information about a project. Also the WebIDE introduced in Gitlab 10.7 uses this method to access a project via the Gitlab API. That's how I first stumbled on this issue as I cannot get WebIDE to Work in 10.7.1

Steps to reproduce

Fetch the project record using the encoded project path.

e.g. /api/v4/projects/group%2Fproject

Example Project

(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)

(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)

What is the current bug behavior?

/api/v4/projects/group%2Fproject return a 404 while /api/v4/projects/1 returns the project's information

(all via authenticated client calls)

What is the expected correct behavior?

/api/v4/projects/group%2Fproject return the actual project information

Relevant logs and/or screenshots

Web console output when launching WebIDE (which uses project paths for API calls) screenshot

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		Ubuntu 14.04
Current User:	git
Using RVM:	no
Ruby Version:	2.3.6p384
Gem Version:	2.6.13
Bundler Version:1.13.7
Rake Version:	12.3.0
Redis Version:	3.2.11
Git Version:	2.14.3
Sidekiq Version:5.0.5
Go Version:	go1.5.1 linux/amd64

GitLab information Version: 10.7.1 Revision: 0d49bb8 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab.domain.com HTTP Clone URL: https://gitlab.domain.com/some-group/some-project.git SSH Clone URL: git@gitlab.domain.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: github

GitLab Shell Version: 7.1.2 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
root@prod-1:~# sudo gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...

GitLab Shell version >= 7.1.2 ? ... OK (7.1.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/2 ... ok 3/3 ... ok 3/4 ... ok 3/5 ... repository is empty 3/6 ... repository is empty 5/7 ... ok 5/8 ... ok 5/9 ... ok 5/10 ... ok 5/11 ... ok 5/12 ... ok 3/13 ... ok 3/14 ... ok 8/15 ... ok 9/16 ... ok 8/17 ... ok 8/18 ... ok 8/19 ... ok 8/20 ... ok 8/21 ... ok 8/22 ... ok 8/23 ... ok 8/24 ... ok 13/25 ... repository is empty 8/26 ... repository is empty 8/27 ... ok 8/28 ... ok 8/29 ... ok 8/30 ... ok 8/31 ... ok 16/32 ... ok 16/33 ... ok 8/34 ... ok 8/35 ... ok 8/36 ... ok 16/37 ... ok 2/38 ... ok 8/39 ... ok 8/40 ... ok 18/41 ... ok 18/42 ... ok 8/43 ... ok 8/44 ... ok 20/45 ... ok 8/46 ... ok 8/47 ... ok 8/48 ... ok 21/49 ... ok 21/50 ... ok 8/51 ... ok 8/52 ... ok 21/53 ... ok 21/54 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

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

Checking Sidekiq ... Finished

Reply by email is disabled in config/gitlab.yml Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

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: ... 3/2 ... yes 3/3 ... yes 3/4 ... yes 3/5 ... yes 3/6 ... yes 5/7 ... yes 5/8 ... yes 5/9 ... yes 5/10 ... yes 5/11 ... yes 5/12 ... yes 3/13 ... yes 3/14 ... yes 8/15 ... yes 9/16 ... yes 8/17 ... yes 8/18 ... yes 8/19 ... yes 8/20 ... yes 8/21 ... yes 8/22 ... yes 8/23 ... yes 8/24 ... yes 13/25 ... yes 8/26 ... yes 8/27 ... yes 8/28 ... yes 8/29 ... yes 8/30 ... yes 8/31 ... yes 16/32 ... yes 16/33 ... yes 8/34 ... yes 8/35 ... yes 8/36 ... yes 16/37 ... yes 2/38 ... yes 8/39 ... yes 8/40 ... yes 18/41 ... yes 18/42 ... yes 8/43 ... yes 8/44 ... yes 20/45 ... yes 8/46 ... yes 8/47 ... yes 8/48 ... yes 21/49 ... yes 21/50 ... yes 8/51 ... yes 8/52 ... yes 21/53 ... yes 21/54 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.14.3) Git user has default SSH configuration? ... yes Active users: ... 5

Checking GitLab ... Finished

Edited by Joern Hartmann