Commit ef61d1f20004f20ec4a421f9bfd698ac070783dd
1 parent
ae006dd9
Exists in
master
and in
4 other branches
fix http push 401
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
lib/gitlab/backend/grack_auth.rb
| ... | ... | @@ -76,13 +76,17 @@ module Grack |
| 76 | 76 | end |
| 77 | 77 | |
| 78 | 78 | def validate_get_request |
| 79 | - project.public || can?(user, :download_code, project) | |
| 79 | + validate_request(@request.params['service']) | |
| 80 | 80 | end |
| 81 | 81 | |
| 82 | 82 | def validate_post_request |
| 83 | - if @request.path_info.end_with?('git-upload-pack') | |
| 83 | + validate_request(File.basename(@request.path)) | |
| 84 | + end | |
| 85 | + | |
| 86 | + def validate_request(service) | |
| 87 | + if service == 'git-upload-pack' | |
| 84 | 88 | project.public || can?(user, :download_code, project) |
| 85 | - elsif @request.path_info.end_with?('git-receive-pack') | |
| 89 | + elsif service == 'git-receive-pack' | |
| 86 | 90 | action = if project.protected_branch?(current_ref) |
| 87 | 91 | :push_code_to_protected_branches |
| 88 | 92 | else | ... | ... |