Allow Periods in Page Names
Thanks to Jeff Zellman.
This commit is contained in:
parent
cbb3e4b74f
commit
bafa7743f1
8 changed files with 11 additions and 40 deletions
|
@ -12,7 +12,10 @@ class RoutesTest < ActionController::TestCase
|
|||
assert_routing('x/y', :controller => 'wiki', :web => 'x', :action => 'y')
|
||||
assert_routing('x/y/z', :controller => 'wiki', :web => 'x', :action => 'y', :id => 'z')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y'}, 'x/y/')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y', :id => 'z'}, 'x/y/z/')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y', :id => 'z'}, 'x/y/z')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y', :id => 'z/'}, 'x/y/z/')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y', :id => 'z/'}, 'x/y/z%2F')
|
||||
assert_recognizes({:web => 'x', :controller => 'wiki', :action => 'y', :id => 'z.w'}, 'x/y/z.w')
|
||||
end
|
||||
|
||||
def test_parse_uri_interestng_cases
|
||||
|
|
|
@ -833,37 +833,19 @@ class WikiControllerTest < ActionController::TestCase
|
|||
assert_equal 'AnonymousCoward', another_page.author
|
||||
end
|
||||
|
||||
def test_save_revised_content_invalid_author_name
|
||||
def test_save_revised_content_author_name_with_period
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'HomePage', 'content' => 'Contents of a very new page',
|
||||
'author' => 'foo.bar'
|
||||
assert_redirected_to :action => 'edit', :controller => 'wiki', :web => 'wiki1', :id => 'HomePage',
|
||||
:content => 'Contents of a very new page'
|
||||
assert r.flash[:error].to_s == 'Your name cannot contain a "."'
|
||||
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'HomePage', 'content' => 'a'*10184,
|
||||
'author' => 'foo.bar'
|
||||
assert_redirected_to :action => 'edit', :controller => 'wiki', :web => 'wiki1', :id => 'HomePage'
|
||||
assert r.flash[:error].to_s == 'Your name cannot contain a "."'
|
||||
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page',
|
||||
'author' => 'foo.bar'
|
||||
assert_redirected_to :action => 'new', :controller => 'wiki', :web => 'wiki1', :id => 'NewPage',
|
||||
:content => 'Contents of a new page'
|
||||
assert r.flash[:error].to_s == 'Your name cannot contain a "."'
|
||||
assert_redirected_to :action => 'show', :controller => 'wiki', :web => 'wiki1', :id => 'HomePage'
|
||||
assert_equal 'foo.bar', @wiki.read_page('wiki1', 'HomePage').author
|
||||
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'a'*10184,
|
||||
'author' => 'foo.bar'
|
||||
assert_redirected_to :action => 'new', :controller => 'wiki', :web => 'wiki1', :id => 'NewPage'
|
||||
assert r.flash[:error].to_s == 'Your name cannot contain a "."'
|
||||
assert_redirected_to :action => 'show', :controller => 'wiki', :web => 'wiki1', :id => 'NewPage'
|
||||
assert_equal 'foo.bar', @wiki.read_page('wiki1', 'NewPage').author
|
||||
end
|
||||
|
||||
def test_save_invalid_author_name
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page',
|
||||
'author' => 'foo.bar'
|
||||
assert_redirected_to :action => 'new', :controller => 'wiki', :web => 'wiki1', :id => 'NewPage',
|
||||
:content => 'Contents of a new page'
|
||||
assert r.flash[:error].to_s == 'Your name cannot contain a "."'
|
||||
|
||||
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page',
|
||||
'author' => "Fu\000Manchu"
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@ class StubUrlGenerator < AbstractUrlGenerator
|
|||
|
||||
def page_link(mode, name, text, web_address, known_page)
|
||||
link = CGI.escape(name)
|
||||
return %{<span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> #{name}</span>} if name.include?('.')
|
||||
title = web_address == 'wiki1' ? '' : " title='#{web_address}'"
|
||||
case mode
|
||||
when :export
|
||||
|
|
|
@ -172,7 +172,7 @@ class PageTest < ActiveSupport::TestCase
|
|||
"<p>Reference to <a class='existingWikiWord' href='\.\./show/MyPage'>H\303\241ppy Page</a>"
|
||||
assert_equal( s +
|
||||
" and to <span class='newWikiWord'>Wanted Page2<a href='../show/WantedPage2'>?</a></span>.pdf " +
|
||||
"and <span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> foo.pdf</span></p>",
|
||||
"and <span class='newWikiWord'>foo.pdf<a href='../show/foo.pdf'>?</a></span></p>",
|
||||
x_test_renderer(new_page.revisions.last).display_content(true) )
|
||||
assert_equal 3, references.size
|
||||
# now it works.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue