BigW Consortium Gitlab

Commit 3cbfb1ee by Dmitriy Zaporozhets

Remove .git from project url end redirect

Ex. redirect from localhost/group/project.git to localhost/group/project It used to prevent 404 error when follow submodule http link like http://localhost/group/project.git
parent 55327823
...@@ -63,6 +63,15 @@ class ApplicationController < ActionController::Base ...@@ -63,6 +63,15 @@ class ApplicationController < ActionController::Base
def project def project
id = params[:project_id] || params[:id] id = params[:project_id] || params[:id]
# Redirect from
# localhost/group/project.git
# to
# localhost/group/project
#
if id =~ /\.git\Z/
redirect_to request.original_url.gsub(/\.git\Z/, '') and return
end
@project = Project.find_with_namespace(id) @project = Project.find_with_namespace(id)
if @project and can?(current_user, :read_project, @project) if @project and can?(current_user, :read_project, @project)
......
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