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