Skip to content
Snippets Groups Projects
Commit ab9dfa8f authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Clarify intentions

parent ccb29955
No related branches found
No related tags found
1 merge request!3361Dismantling Grack::Auth part 1: Git HTTP clients
Loading
Loading
@@ -108,11 +108,14 @@ class Projects::GitHttpController < Projects::ApplicationController
id = params[:project_id]
return if id.nil?
if id.end_with?('.wiki.git')
id.slice(0, id.length - 9)
elsif id.end_with?('.git')
id.slice(0, id.length - 4)
%w{.wiki.git .git}.each do |suffix|
# Be careful to only remove the suffix from the end of 'id'.
# Accidentally removing it from the middle is how security
# vulnerabilities happen!
return id.slice(0, id.length - suffix.length) if id.end_with?(suffix)
end
nil
end
 
def repository
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment