Prevent Renaming to a Null Page Name
Fix http://rubyforge.org/tracker/index.php?func=detail&aid=27649&group_id=186&atid=783
This commit is contained in:
parent
c8ef0a3dd4
commit
d67ce28855
2 changed files with 3 additions and 1 deletions
|
@ -273,6 +273,7 @@ class WikiController < ApplicationController
|
||||||
cookies['author'] = { :value => author_name.dup.as_bytes, :expires => Time.utc(2030) }
|
cookies['author'] = { :value => author_name.dup.as_bytes, :expires => Time.utc(2030) }
|
||||||
if @page
|
if @page
|
||||||
new_name = params['new_name'] ? params['new_name'].purify : @page_name
|
new_name = params['new_name'] ? params['new_name'].purify : @page_name
|
||||||
|
new_name = @page_name if new_name.empty?
|
||||||
prev_content = @page.current_revision.content
|
prev_content = @page.current_revision.content
|
||||||
raise Instiki::ValidationError.new('Your new title cannot contain a "."') if new_name.include? '.'
|
raise Instiki::ValidationError.new('Your new title cannot contain a "."') if new_name.include? '.'
|
||||||
raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if
|
raise Instiki::ValidationError.new('A page named "' + new_name.escapeHTML + '" already exists.') if
|
||||||
|
|
|
@ -55,7 +55,8 @@ function toggleVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRedirect(){
|
function addRedirect(){
|
||||||
if (document.getElementById('new_name').value != "<%= escape_javascript(@page.name) %>" ) {
|
var e = document.getElementById('new_name').value;
|
||||||
|
if ( e != "<%= escape_javascript(@page.name) %>" && e != '') {
|
||||||
var content = document.getElementById('content');
|
var content = document.getElementById('content');
|
||||||
content.value = '[[!redirects <%= escape_javascript(@page.name) %>]]\n' + content.value
|
content.value = '[[!redirects <%= escape_javascript(@page.name) %>]]\n' + content.value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue