Check existance of a revision and respond with 404 if it doesn't exist.
This commit is contained in:
parent
08a66badb9
commit
fe868135c4
2 changed files with 8 additions and 0 deletions
|
@ -298,6 +298,9 @@ class WikiController < ApplicationController
|
|||
|
||||
def get_page_and_revision
|
||||
@revision = @page.revisions[@params['rev'].to_i]
|
||||
if @revision.nil?
|
||||
render_text 'Page name is not specified', '404 Not Found'
|
||||
end
|
||||
end
|
||||
|
||||
def parse_category
|
||||
|
|
|
@ -371,6 +371,11 @@ class WikiControllerTest < Test::Unit::TestCase
|
|||
assert_equal @home.revisions[0], r.template_objects['revision']
|
||||
end
|
||||
|
||||
def test_non_existant_revision_of_existing_page
|
||||
r = process 'revision', 'web' => 'wiki1', 'id' => 'HomePage', 'rev' => '5'
|
||||
assert_response :missing
|
||||
end
|
||||
|
||||
|
||||
def test_rollback
|
||||
# rollback shows a form where a revision can be edited.
|
||||
|
|
Loading…
Reference in a new issue