summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-12-26 12:46:07 +0000
committerOswaldo Ferreira <oswaldo@gitlab.com>2017-12-26 14:00:09 +0000
commit97ff3fcdeeac23d9ac2dd9a57b06abe46ace89a9 (patch)
treeac70c231f6142e60341e5271fa7ac91fc2e1ea09 /lib
parent3560b93e261efadc46a36512527dadb4d2a1a284 (diff)
downloadgitlab-ce-97ff3fcdeeac23d9ac2dd9a57b06abe46ace89a9.tar.gz
Merge branch 'sh-handle-anonymous-clones-project-moved' into 'master'
Fix Error 500s with anonymous clones for a project that has moved Closes #41457 See merge request gitlab-org/gitlab-ce!16128 (cherry picked from commit a5a0f3f725c4f5c6d11d33e18493d93e07e53183) a83c41f6 Fix Error 500s with anonymous clones for a project that has moved b6c711fd Disable redirect messages for anonymous clones
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/checks/project_moved.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/checks/project_moved.rb b/lib/gitlab/checks/project_moved.rb
index 3a1c0a3455e..dfb2f4d4054 100644
--- a/lib/gitlab/checks/project_moved.rb
+++ b/lib/gitlab/checks/project_moved.rb
@@ -21,6 +21,10 @@ module Gitlab
end
def add_redirect_message
+ # Don't bother with sending a redirect message for anonymous clones
+ # because they never see it via the `/internal/post_receive` endpoint
+ return unless user.present? && project.present?
+
Gitlab::Redis::SharedState.with do |redis|
key = self.class.redirect_message_key(user.id, project.id)
redis.setex(key, 5.minutes, redirect_message)