Commit 63dac853 authored by blackst0ne's avatar blackst0ne

Fixed redirection from http://someproject.git to http://someproject

parent fd46fb1c
...@@ -18,7 +18,7 @@ class Projects::ApplicationController < ApplicationController ...@@ -18,7 +18,7 @@ class Projects::ApplicationController < ApplicationController
# to # to
# localhost/group/project # localhost/group/project
# #
if id =~ /\.git\Z/ if params[:format] == 'git'
redirect_to request.original_url.gsub(/\.git\/?\Z/, '') redirect_to request.original_url.gsub(/\.git\/?\Z/, '')
return return
end end
......
---
title: Redirect http://someproject.git to http://someproject
merge_request:
author: blackst0ne
...@@ -213,6 +213,17 @@ describe ProjectsController do ...@@ -213,6 +213,17 @@ describe ProjectsController do
expect(response.status).to eq 404 expect(response.status).to eq 404
end end
end end
context "redirection from http://someproject.git" do
it 'redirects to project page (format.html)' do
project = create(:project, :public)
get :show, namespace_id: project.namespace.path, id: project.path, format: :git
expect(response).to have_http_status(302)
expect(response).to redirect_to(namespace_project_path)
end
end
end end
describe "#update" do describe "#update" do
......
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