Commit a65394f3 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce

parents 6f59f73c 5cf10240
...@@ -45,6 +45,10 @@ class ApplicationController < ActionController::Base ...@@ -45,6 +45,10 @@ class ApplicationController < ActionController::Base
redirect_to request.referer.present? ? :back : default, options redirect_to request.referer.present? ? :back : default, options
end end
def not_found
render_404
end
protected protected
# This filter handles both private tokens and personal access tokens # This filter handles both private tokens and personal access tokens
......
...@@ -88,4 +88,6 @@ Rails.application.routes.draw do ...@@ -88,4 +88,6 @@ Rails.application.routes.draw do
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ } get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }
root to: "root#index" root to: "root#index"
get '*unmatched_route', to: 'application#not_found'
end end
...@@ -113,18 +113,19 @@ module ExtractsPath ...@@ -113,18 +113,19 @@ module ExtractsPath
@id = get_id @id = get_id
@ref, @path = extract_ref(@id) @ref, @path = extract_ref(@id)
@repo = @project.repository @repo = @project.repository
if @options[:extended_sha1].blank?
@commit = @repo.commit(@ref) if @options[:extended_sha1].present?
else
@commit = @repo.commit(@options[:extended_sha1]) @commit = @repo.commit(@options[:extended_sha1])
end else
@commit = @repo.commit(@ref)
if @path.empty? && !@commit if @path.empty? && !@commit && @id.ends_with?('.atom')
@id = @ref = extract_ref_without_atom(@id) @id = @ref = extract_ref_without_atom(@id)
@commit = @repo.commit(@ref) @commit = @repo.commit(@ref)
request.format = :atom if @commit request.format = :atom if @commit
end end
end
raise InvalidPathError unless @commit raise InvalidPathError unless @commit
......
...@@ -412,9 +412,10 @@ describe 'Git HTTP requests', lib: true do ...@@ -412,9 +412,10 @@ describe 'Git HTTP requests', lib: true do
context "when the params are anything else" do context "when the params are anything else" do
let(:params) { { service: 'git-implode-pack' } } let(:params) { { service: 'git-implode-pack' } }
before { get path, params }
it "fails to find a route" do it "redirects to the sign-in page" do
expect { get(path, params) }.to raise_error(ActionController::RoutingError) expect(response).to redirect_to(new_user_session_path)
end end
end end
end end
......
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