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:
parent
23e28f3702
commit
05b76f7625
|
@ -13,7 +13,8 @@
|
||||||
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName()',
|
||||||
'accept-charset' => 'utf-8' }) do %>
|
'accept-charset' => 'utf-8' }) do %>
|
||||||
<div>
|
<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">
|
<div id="editFormButtons">
|
||||||
<input type="submit" value="Submit" accesskey="s"/> as
|
<input type="submit" value="Submit" accesskey="s"/> as
|
||||||
<%= text_field_tag :author, h(@author.purify),
|
<%= text_field_tag :author, h(@author.purify),
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
<% form_tag({ :action => 'save', :web => @web.address, :id => @page_name },
|
<% form_tag({ :action => 'save', :web => @web.address, :id => @page_name },
|
||||||
{ 'id' => 'editForm', 'method' => 'post', 'onsubmit' => 'cleanAuthorName();', 'accept-charset' => 'utf-8' }) do %>
|
{ '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">
|
<div id="editFormButtons">
|
||||||
<input type="submit" value="Submit" accesskey="s"/> as
|
<input type="submit" value="Submit" accesskey="s"/> as
|
||||||
<%= text_field_tag :author, @author,
|
<%= text_field_tag :author, @author,
|
||||||
|
|
|
@ -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",
|
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => "Contents of a new page\r\n\000",
|
||||||
'author' => 'AuthorOfNewPage'
|
'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 ['AuthorOfNewPage'], r.cookies['author'].value
|
||||||
assert_equal Time.utc(2030), r.cookies['author'].expires
|
assert_equal Time.utc(2030), r.cookies['author'].expires
|
||||||
end
|
end
|
||||||
|
@ -602,6 +602,24 @@ class WikiControllerTest < Test::Unit::TestCase
|
||||||
assert !home_page.locked?(Time.now)
|
assert !home_page.locked?(Time.now)
|
||||||
end
|
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
|
def test_dnsbl_filter_deny_action
|
||||||
@request.remote_addr = "127.0.0.2"
|
@request.remote_addr = "127.0.0.2"
|
||||||
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => "Contents of a new page\r\n",
|
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => "Contents of a new page\r\n",
|
||||||
|
|
Loading…
Reference in a new issue