From 8d7de50ca8f7b440cb67c8161122d20909a3a93f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 22 Apr 2007 09:50:16 +0000 Subject: Fixed 10211 Wiki names can't have periods in them. Same validations as WikiPage model now applied to wiki start page. git-svn-id: http://redmine.rubyforge.org/svn/trunk@463 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/wiki.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/models/wiki.rb') diff --git a/app/models/wiki.rb b/app/models/wiki.rb index e362273ae..8233c3d48 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.rb @@ -20,6 +20,7 @@ class Wiki < ActiveRecord::Base has_many :pages, :class_name => 'WikiPage', :dependent => :destroy validates_presence_of :start_page + validates_format_of :start_page, :with => /^[^,\.\/\?\;\|]*$/ # find the page with the given title # if page doesn't exist, return a new page @@ -36,7 +37,7 @@ class Wiki < ActiveRecord::Base # turn a string into a valid page title def self.titleize(title) # replace spaces with _ and remove unwanted caracters - title = title.gsub(/\s+/, '_').delete(',;|') if title + title = title.gsub(/\s+/, '_').delete(',./?;|') if title # upcase the first letter title = title[0..0].upcase + title[1..-1] if title title -- cgit v1.2.3