Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-05 18:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-05 18:08:56 +0300
commit61265b9f01c7db3d4f6e1266d165b1c85be7b9e7 (patch)
treeb6589df984e18e3b008a155c8d9ffcae75cf7c91 /lib/gitlab/git_access.rb
parent5460c19548d3d3d2ff764ceff05c2b72aa2d3a32 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/git_access.rb')
-rw-r--r--lib/gitlab/git_access.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index d8c992155cb..ecf45aebb0c 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -137,6 +137,10 @@ module Gitlab
private
def check_container!
+ # Strict nil check, to avoid any surprises with Object#present?
+ # which can delegate to #empty?
+ raise NotFoundError, not_found_message if container.nil?
+
check_project! if project?
end
@@ -204,9 +208,7 @@ module Gitlab
end
def check_project_accessibility!
- if project.blank? || !can_read_project?
- raise NotFoundError, not_found_message
- end
+ raise NotFoundError, not_found_message unless can_read_project?
end
def not_found_message
@@ -279,10 +281,10 @@ module Gitlab
error_message(:download)
end
- # We assume that all git-access classes are in project context by default.
- # Override this method to be more specific.
def project?
- true
+ # Strict nil check, to avoid any surprises with Object#present?
+ # which can delegate to #empty?
+ !project.nil?
end
def project
@@ -290,7 +292,7 @@ module Gitlab
end
def check_push_access!
- if container.repository_read_only?
+ if project&.repository_read_only?
raise ForbiddenError, error_message(:read_only)
end