diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-12-25 07:10:28 +0000 |
---|---|---|
committer | Tiago <tiagonbotelho@hotmail.com> | 2017-12-29 16:43:45 +0000 |
commit | aa51106be19c1bfcdfb2c83304764eeb0cb6afbe (patch) | |
tree | d310f2bb79c8f912fbdbdacefeb2077f695c7f7c /lib | |
parent | 6a8df993631d0b92789a4c6b689a3b7274718794 (diff) | |
download | gitlab-ce-aa51106be19c1bfcdfb2c83304764eeb0cb6afbe.tar.gz |
Merge branch 'sh-handle-orphaned-deploy-keys' into 'master'
Gracefully handle orphaned write deploy keys in /internal/post_receive
Closes #41466
See merge request gitlab-org/gitlab-ce!16127
(cherry picked from commit 228f42b58b8f23b53494d32ff964aca47e90ac2e)
36bdf3dc Gracefully handle orphaned write deploy keys in /internal/post_receive
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/internal.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/api/internal.rb b/lib/api/internal.rb index ccaaeca10d4..79b302aae70 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -190,9 +190,12 @@ module API project = Gitlab::GlRepository.parse(params[:gl_repository]).first user = identify(params[:identifier]) - redirect_message = Gitlab::Checks::ProjectMoved.fetch_redirect_message(user.id, project.id) - if redirect_message - output[:redirected_message] = redirect_message + + # A user is not guaranteed to be returned; an orphaned write deploy + # key could be used + if user + redirect_message = Gitlab::Checks::ProjectMoved.fetch_redirect_message(user.id, project.id) + output[:redirected_message] = redirect_message if redirect_message end output |