Commit 38fbcb99 authored by Lin Jen-Shin's avatar Lin Jen-Shin

So deploy key might not have a corresponding user

parent 24d9f51e
...@@ -46,7 +46,7 @@ module Gitlab ...@@ -46,7 +46,7 @@ module Gitlab
def download_access_check def download_access_check
if user if user
user_download_access_check user_download_access_check
elsif !Guest.can?(:download_code, project) elsif deploy_key.nil? && !Guest.can?(:download_code, project)
raise UnauthorizedError, ERROR_MESSAGES[:download] raise UnauthorizedError, ERROR_MESSAGES[:download]
end end
end end
...@@ -91,7 +91,7 @@ module Gitlab ...@@ -91,7 +91,7 @@ module Gitlab
def deploy_key_push_access_check(changes) def deploy_key_push_access_check(changes)
if deploy_key.can_push? if deploy_key.can_push?
check_repository_existence! check_repository_existence!
check_change_access!(changes) check_change_access!(changes) if user
else else
raise UnauthorizedError, ERROR_MESSAGES[:deploy_key] raise UnauthorizedError, ERROR_MESSAGES[:deploy_key]
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment