More Philip Taylor Phun
More checks that page_names are valid utf_8.
This commit is contained in:
parent
5db9ddaf47
commit
5a0a6b2ca1
1 changed files with 5 additions and 3 deletions
|
@ -163,7 +163,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
if @page.nil?
|
if @page.nil? or not @page_name.is_utf8?
|
||||||
redirect_home
|
redirect_home
|
||||||
elsif @page.locked?(Time.now) and not params['break_lock']
|
elsif @page.locked?(Time.now) and not params['break_lock']
|
||||||
redirect_to :web => @web_name, :action => 'locked', :id => @page_name
|
redirect_to :web => @web_name, :action => 'locked', :id => @page_name
|
||||||
|
@ -173,10 +173,12 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def locked
|
def locked
|
||||||
|
render(:text => 'Page name is not valid utf-8.', :status => 400, :layout => 'error') unless @page_name.is_utf8?
|
||||||
# to template
|
# to template
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
render(:text => 'Page name is not valid utf-8.', :status => 400, :layout => 'error') unless @page_name.is_utf8?
|
||||||
# to template
|
# to template
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -226,7 +228,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save
|
||||||
render(:status => 404, :text => 'Undefined page name', :layout => 'error') and return if @page_name.nil?
|
render(:status => 404, :text => 'Undefined page name', :layout => 'error') and return if @page_name.nil? or not @page_name.is_utf8?
|
||||||
unless (request.post? || ENV["RAILS_ENV"] == "test")
|
unless (request.post? || ENV["RAILS_ENV"] == "test")
|
||||||
headers['Allow'] = 'POST'
|
headers['Allow'] = 'POST'
|
||||||
render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error')
|
render(:status => 405, :text => 'You must use an HTTP POST', :layout => 'error')
|
||||||
|
@ -293,7 +295,7 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not @page_name.nil? and not @page_name.empty?
|
if not @page_name.nil? and @page_name.is_utf8? and not @page_name.empty?
|
||||||
redirect_to :web => @web_name, :action => 'new', :id => @page_name
|
redirect_to :web => @web_name, :action => 'new', :id => @page_name
|
||||||
else
|
else
|
||||||
render :text => 'Page name is not specified', :status => 404, :layout => 'error'
|
render :text => 'Page name is not specified', :status => 404, :layout => 'error'
|
||||||
|
|
Loading…
Add table
Reference in a new issue