Philip Taylor Freakout Edition

Doubtless, he would have been fleetingly ecstatic.
Alas, he a) probably doesn't subscribe to the bzr feed,
and b) is probably asleep at the moment.
This commit is contained in:
Jacques Distler 2008-12-17 01:42:24 -06:00
parent 23e28f3702
commit 05b76f7625
3 changed files with 23 additions and 3 deletions

View file

@ -13,7 +13,8 @@
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
'accept-charset' => 'utf-8' }) do %>
<div>
<textarea name="content" id="content" rows="24" cols="60"><%= h(flash[:content] || (params['content'] || @page.content).purify) %></textarea>
<textarea name="content" id="content" rows="24" cols="60"><%= h(flash[:content] ||
((params['content'] && params['content'].is_utf8?) ? params['content'] : @page.content).purify) %></textarea>
<div id="editFormButtons">
<input type="submit" value="Submit" accesskey="s"/> as
<%= text_field_tag :author, h(@author.purify),

View file

@ -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 %>
<textarea name="content" id="content" rows="24" cols="60"><%= h(flash[:content] || (params['content'] || '').purify ) %></textarea>
<textarea name="content" id="content" rows="24" cols="60"><%= h(flash[:content] ||
( (params['content'] && params['content'].is_utf8?) ? params['content'] : '').purify ) %></textarea>
<div id="editFormButtons">
<input type="submit" value="Submit" accesskey="s"/> as
<%= text_field_tag :author, @author,

View file

@ -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}<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",