Commit 11d56a15 authored by Kia Mei Somabes's avatar Kia Mei Somabes

Redirect commits to root_ref if no ref is provided

parent 0ed8f349
...@@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base ...@@ -63,6 +63,10 @@ class ApplicationController < ActionController::Base
render_503 render_503
end end
def redirect_commits_root
redirect_to :controller => 'commits', :action => 'show', :id => @repository.root_ref
end
def redirect_back_or_default(default: root_path, options: {}) def redirect_back_or_default(default: root_path, options: {})
redirect_to request.referer.present? ? :back : default, options redirect_to request.referer.present? ? :back : default, options
end end
......
---
title: Redirect commits to root if no ref is provided (31576)
merge_request:
author: Kia Mei Somabes
type: added
...@@ -83,6 +83,7 @@ scope format: false do ...@@ -83,6 +83,7 @@ scope format: false do
get '/raw/*id', to: 'raw#show', as: :raw get '/raw/*id', to: 'raw#show', as: :raw
get '/blame/*id', to: 'blame#show', as: :blame get '/blame/*id', to: 'blame#show', as: :blame
get '/commits/', to: 'application#redirect_commits_root', as: :commits_root
get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures get '/commits/*id/signatures', to: 'commits#signatures', as: :signatures
get '/commits/*id', to: 'commits#show', as: :commits get '/commits/*id', to: 'commits#show', as: :commits
......
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