Merge branch 'git_to_html_redirection' into 'master'
Redirect http://someproject.git to http://someproject Closes #26275 See merge request !8951
This commit is contained in:
commit
b7685ad113
3 changed files with 16 additions and 1 deletions
|
@ -18,7 +18,7 @@ class Projects::ApplicationController < ApplicationController
|
|||
# to
|
||||
# localhost/group/project
|
||||
#
|
||||
if id =~ /\.git\Z/
|
||||
if params[:format] == 'git'
|
||||
redirect_to request.original_url.gsub(/\.git\/?\Z/, '')
|
||||
return
|
||||
end
|
||||
|
|
4
changelogs/unreleased/git_to_html_redirection.yml
Normal file
4
changelogs/unreleased/git_to_html_redirection.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Redirect http://someproject.git to http://someproject
|
||||
merge_request:
|
||||
author: blackst0ne
|
|
@ -213,6 +213,17 @@ describe ProjectsController do
|
|||
expect(response.status).to eq 404
|
||||
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
|
||||
|
||||
describe "#update" do
|
||||
|
|
Loading…
Reference in a new issue