From ef61d1f20004f20ec4a421f9bfd698ac070783dd Mon Sep 17 00:00:00 2001 From: tsl0922 Date: Fri, 19 Apr 2013 16:43:54 +0800 Subject: [PATCH] fix http push 401 --- lib/gitlab/backend/grack_auth.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index f46455f47..8b43b6068 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -76,13 +76,17 @@ module Grack end def validate_get_request - project.public || can?(user, :download_code, project) + validate_request(@request.params['service']) end def validate_post_request - if @request.path_info.end_with?('git-upload-pack') + validate_request(File.basename(@request.path)) + end + + def validate_request(service) + if service == 'git-upload-pack' project.public || can?(user, :download_code, project) - elsif @request.path_info.end_with?('git-receive-pack') + elsif service == 'git-receive-pack' action = if project.protected_branch?(current_ref) :push_code_to_protected_branches else -- 2.11.0