Project

General

Profile

Patch #4307 ยป 0001-Ruby-1.9.1p343-breaks-w-and-s-replace-with-word-and-.patch

Alexey Froloff, 2009-11-29 17:07

View differences:

app/models/custom_field.rb
validates_presence_of :name, :field_format
validates_uniqueness_of :name, :scope => :type
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i
validates_format_of :name, :with => /^[[:word:][:space:]\.\'\-]*$/i
validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
def initialize(attributes = nil)
app/models/issue_status.rb
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
def after_save
IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
app/models/role.rb
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
def permissions
read_attribute(:permissions) || []
app/models/tracker.rb
validates_presence_of :name
validates_uniqueness_of :name
validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
def to_s; name end
app/models/user.rb
# Login must contain lettres, numbers, underscores only
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
validates_length_of :login, :maximum => 30
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i
validates_format_of :firstname, :lastname, :with => /^[[:word:][:space:]\'\-\.]*$/i
validates_length_of :firstname, :lastname, :maximum => 30
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
validates_length_of :mail, :maximum => 60, :allow_nil => true
lib/redcloth3.rb
PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
PUNCT_Q = Regexp::quote( '*-_+^~%' )
HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
HYPERLINK = '(\S+?)([^[:word:][:space:]/;=\?]*?)(?=\s|<|$)'
# Text markup tags, don't conflict with block tags
SIMPLE_HTML_TAGS = [
lib/redmine/wiki_formatting/textile/formatter.rb
toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1'
# replaces non word caracters by dashes
anchor = toc_item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
anchor = toc_item.gsub(%r{[^[:word:][:space:]\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
unless anchor.blank?
if tag =~ /^h(\d)$/
lib/tasks/migrate_from_mantis.rake
def firstname
@firstname = realname.blank? ? username : realname.split.first[0..29]
@firstname.gsub!(/[^\w\s\'\-]/i, '')
@firstname.gsub!(/[^[:word:][:space:]\'\-]/i, '')
@firstname
end
def lastname
@lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29]
@lastname.gsub!(/[^\w\s\'\-]/i, '')
@lastname.gsub!(/[^[:word:][:space:]\'\-]/i, '')
@lastname = '-' if @lastname.blank?
@lastname
end
......
end
def name
read_attribute(:name)[0..29].gsub(/[^\w\s\'\-]/, '-')
read_attribute(:name)[0..29].gsub(/[^[:word:][:space:]\'\-]/, '-')
end
end
lib/tasks/migrate_from_trac.rake
ln = ($2 || '-').strip
u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
:firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^\w\s\'\-]/i, '-'),
:lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^\w\s\'\-]/i, '-')
:firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^[:word:][:space:]\'\-]/i, '-'),
:lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^[:word:][:space:]\'\-]/i, '-')
u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-')
u.password = 'trac'
    (1-1/1)