Check existance of a revision and respond with 404 if it doesn't exist.

This commit is contained in:
Alexey Verkhovsky 2005-08-11 05:30:20 +00:00
parent 08a66badb9
commit fe868135c4
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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.