From 7d0b1b383009dddb535e288f8cbf38b1aa8fb2aa Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 14 Jan 2011 20:22:36 +0000 Subject: [PATCH] Respond with 404 instead of 500 when revision/entry is not found in the repository (#7307). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4710 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/repositories_controller.rb | 2 +- test/functional/repositories_git_controller_test.rb | 2 +- test/functional/repositories_mercurial_controller_test.rb | 2 +- test/functional/repositories_subversion_controller_test.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3e4584ead..72104d575 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -226,7 +226,7 @@ class RepositoriesController < ApplicationController end def show_error_not_found - render_error l(:error_scm_not_found) + render_error :message => l(:error_scm_not_found), :status => 404 end # Handler for Redmine::Scm::Adapters::CommandFailed exception diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index e08c41b48..53b5ea7cc 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -192,7 +192,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase @repository.reload ['', ' ', nil].each do |r| get :revision, :id => 1, :rev => r - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end end diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index b565863c3..de382bbbf 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.rb @@ -201,7 +201,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase @repository.reload ['', ' ', nil].each do |r| get :revision, :id => 1, :rev => r - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end end diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 5478cee27..1a13797d8 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -168,14 +168,14 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase def test_invalid_revision get :revision, :id => 1, :rev => 'something_weird' - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end def test_empty_revision ['', ' ', nil].each do |r| get :revision, :id => 1, :rev => r - assert_response 500 + assert_response 404 assert_error_tag :content => /was not found/ end end