diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 6dbaa9bc..76b36415 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -13,7 +13,8 @@ { 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()', 'accept-charset' => 'utf-8' }) do %>
- +
as <%= text_field_tag :author, h(@author.purify), diff --git a/app/views/wiki/new.rhtml b/app/views/wiki/new.rhtml index 9e30b32e..ebc74414 100644 --- a/app/views/wiki/new.rhtml +++ b/app/views/wiki/new.rhtml @@ -13,7 +13,8 @@ <% form_tag({ :action => 'save', :web => @web.address, :id => @page_name }, { 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) do %> - +
as <%= text_field_tag :author, @author, diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index b0402efa..8e21900c 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -563,7 +563,7 @@ class WikiControllerTest < Test::Unit::TestCase r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => "Contents of a new page\r\n\000", 'author' => 'AuthorOfNewPage' - assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'NewPage' + assert_redirected_to :web => 'wiki1', :action => 'new', :id => 'NewPage', :content => '' assert_equal ['AuthorOfNewPage'], r.cookies['author'].value assert_equal Time.utc(2030), r.cookies['author'].expires end @@ -602,6 +602,24 @@ class WikiControllerTest < Test::Unit::TestCase assert !home_page.locked?(Time.now) end + def test_save_new_revision_of_existing_page_invalid_utf8 + @home.lock(Time.now, 'Batman') + current_revisions = @home.revisions.size + + r = process 'save', 'web' => 'wiki1', 'id' => 'HomePage', 'content' => "Revised HomePage\000", + 'author' => 'Batman' + + assert_redirected_to :web => 'wiki1', :action => 'edit', :id => 'HomePage', + :content => 'HisWay would be MyWay $\sin(x)\begin{svg}\end{svg}\includegraphics[width' + + '=3em]{foo}$ in kinda ThatWay in HisWay though MyWay \OverThere -- see SmartEng' + + 'ine in that SmartEngineGUI' + assert_equal ['Batman'], r.cookies['author'].value + home_page = @wiki.read_page('wiki1', 'HomePage') + assert_equal current_revisions, home_page.revisions.size + assert_equal 'DavidHeinemeierHansson', home_page.author + assert !home_page.locked?(Time.now) + end + def test_dnsbl_filter_deny_action @request.remote_addr = "127.0.0.2" r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => "Contents of a new page\r\n",