From 3cbfb1ee7c28c0171bc4c584ce3c852b07f8521a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 14 Oct 2013 13:27:39 +0300 Subject: [PATCH] Remove .git from project url end redirect --- app/controllers/application_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d974600..85b9586 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -63,6 +63,15 @@ class ApplicationController < ActionController::Base def project 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) if @project and can?(current_user, :read_project, @project) -- libgit2 0.21.2