Calls to show with unspecified page name cause HTTP 404, not HTTP 500
This commit is contained in:
parent
6cceead11c
commit
c73db9ff5d
|
@ -207,7 +207,11 @@ class WikiController < ApplicationController
|
|||
end
|
||||
end
|
||||
else
|
||||
redirect_to :web => @web_name, :action => 'new', :id => CGI.escape(@page_name)
|
||||
if not @page_name.nil? and not @page_name.empty?
|
||||
redirect_to :web => @web_name, :action => 'new', :id => CGI.escape(@page_name)
|
||||
else
|
||||
render_text 'Page name is not specified', '404 Not Found'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -552,6 +552,14 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'UnknownPage'
|
||||
end
|
||||
|
||||
def test_show_no_page
|
||||
r = process('show', 'id' => '', 'web' => 'wiki1')
|
||||
assert_equal 404, r.response_code
|
||||
|
||||
r = process('show', 'web' => 'wiki1')
|
||||
assert_equal 404, r.response_code
|
||||
end
|
||||
|
||||
|
||||
def test_tex
|
||||
r = process('tex', 'web' => 'wiki1', 'id' => 'HomePage')
|
||||
|
|
Loading…
Reference in a new issue