diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2019-04-05 10:51:42 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2019-04-05 10:51:42 +0000 |
commit | 2fdda74458bb7b58a6a18b72170a572f72afdd95 (patch) | |
tree | 1d593dc1d7ac185ba1d6977865f79d0871b1f846 /lib/gitlab/repo_path.rb | |
parent | 934dabaf6da42db7197e07dc95cf88d34e847306 (diff) | |
download | gitlab-ce-2fdda74458bb7b58a6a18b72170a572f72afdd95.tar.gz |
Fall back to project repository type by default
This makes sure that we always have a repository type when trying to
parse a repository from a path.
This is needed because sometimes we want to perform access checks as
if the project already existed, for example when creating a project on
push.
Before this we were only doing that when accessing git over http, this
makes sure it also works correctly when accessing git over SSH
Diffstat (limited to 'lib/gitlab/repo_path.rb')
-rw-r--r-- | lib/gitlab/repo_path.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/repo_path.rb b/lib/gitlab/repo_path.rb index 207a80b7db2..b4f41b9cd9a 100644 --- a/lib/gitlab/repo_path.rb +++ b/lib/gitlab/repo_path.rb @@ -24,7 +24,10 @@ module Gitlab return [project, type, redirected_path] if project end - nil + # When a project did not exist, the parsed repo_type would be empty. + # In that case, we want to continue with a regular project repository. As we + # could create the project if the user pushing is allowed to do so. + [nil, Gitlab::GlRepository.default_type, nil] end def self.find_project(project_path) |