Also check if the specified page is there, and return 404 if not
This commit is contained in:
parent
fe868135c4
commit
0f35016069
2 changed files with 10 additions and 3 deletions
|
@ -297,9 +297,11 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_page_and_revision
|
def get_page_and_revision
|
||||||
@revision = @page.revisions[@params['rev'].to_i]
|
revision_index = (@params['rev'] || 0).to_i
|
||||||
if @revision.nil?
|
if @page.nil? or @page.revisions[revision_index].nil?
|
||||||
render_text 'Page name is not specified', '404 Not Found'
|
render_text 'Page not found', '404 Not Found'
|
||||||
|
else
|
||||||
|
@revision = @page.revisions[revision_index]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -375,6 +375,11 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '5'
|
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '5'
|
||||||
assert_response :missing
|
assert_response :missing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_revision_of_nonexistant_page
|
||||||
|
r = process 'revision', 'web' => 'wiki1', 'id' => 'NonExistantPage', 'rev' => '0'
|
||||||
|
assert_response :missing
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def test_rollback
|
def test_rollback
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue