regression, projects/:id/fork returns 404 instead of 409

Summary

projects/:id/fork returned 409 in case the fork already existed since I update to 12.1.1 the API returns 404 with body {"message":"404 Target Namespace Not Found"}

Some more details for my specific use case:

  • a private repository is forked where the user which does the forking has the role Developer.
  • I disabled the merge request rights in the fork in the UI and enabled it again => the audit log states the right was changed from public (IMO a bug as well; a private repo should have internal per default but that's another issue) to private and back to internal
  • the user still sees in the UI that he already forked the project.

Steps to reproduce

fork a project which you have already forked

What is the current bug behavior?

404

What is the expected correct behavior?

409

Output of checks

This bug happens on a self-hosted gitlab running: 12.1.1-ee (gitlab-ee@b49d65858943789f6620abf95b6d081a1d18654f)

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.21.0 Sidekiq Version:5.2.7 Go Version: unknown

GitLab information Version: 12.1.1-ee Revision: b49d6585894 Directory: /mnt/disk/opt-gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.7 URL: https://scm HTTP Clone URL: https://scm/some-group/some-project.git SSH Clone URL: git@scm:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 9.3.0 Repository storage paths:

  • default: /mnt/disk/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

GitLab Shell: ... GitLab Shell version >= 9.3.0 ? ... OK (9.3.0) 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 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: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 81 users of 100 limit.

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? ... no Try fixing it: Install the init script For more information see: doc/install/installation.md in section "Install Init Script" Please fix the error above and rerun the checks. Init script up-to-date? ... can't check because of previous errors Projects have namespace: ... 3/5 ... yes 10/6 ... yes 13/12 ... yes 13/13 ... yes 3/14 ... yes 3/15 ... yes 3/16 ... yes 14/17 ... yes 14/18 ... yes 15/19 ... yes 17/20 ... yes 12/21 ... yes 15/25 ... yes 15/26 ... yes 18/27 ... yes 3/28 ... yes 9/31 ... yes 23/32 ... yes 3/33 ... yes 18/35 ... yes 6/36 ... yes 33/37 ... yes 33/38 ... yes 33/39 ... yes 19/40 ... yes 33/41 ... yes 36/42 ... yes 3/43 ... yes 3/44 ... yes 14/45 ... yes 9/47 ... yes 9/48 ... yes 9/49 ... yes 36/50 ... yes 36/51 ... yes 36/52 ... yes 36/54 ... yes 9/57 ... yes 37/60 ... yes 41/63 ... yes 37/64 ... yes 19/65 ... yes 45/66 ... yes 45/71 ... yes 19/73 ... yes 45/75 ... yes 23/76 ... yes 47/77 ... yes 49/79 ... yes 49/80 ... yes 49/82 ... yes 49/83 ... yes 49/84 ... yes 49/85 ... yes 49/86 ... yes 45/87 ... yes 37/92 ... yes 49/93 ... yes 41/94 ... yes 41/95 ... yes 41/97 ... yes 49/98 ... yes 60/100 ... yes 60/104 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.21.0 ? ... yes (2.21.0) Git user has default SSH configuration? ... yes Active users: ... 23 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by Robert Stoll