0001-Ruby-1.9.1p343-breaks-w-and-s-replace-with-word-and-.patch

Alexey Froloff, 2009-11-29 17:07

Download (6.68 KB)

View differences:

app/models/custom_field.rb
32 32
  validates_presence_of :name, :field_format
33 33
  validates_uniqueness_of :name, :scope => :type
34 34
  validates_length_of :name, :maximum => 30
35
  validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i
35
  validates_format_of :name, :with => /^[[:word:][:space:]\.\'\-]*$/i
36 36
  validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
37 37

  
38 38
  def initialize(attributes = nil)
app/models/issue_status.rb
23 23
  validates_presence_of :name
24 24
  validates_uniqueness_of :name
25 25
  validates_length_of :name, :maximum => 30
26
  validates_format_of :name, :with => /^[\w\s\'\-]*$/i
26
  validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
27 27

  
28 28
  def after_save
29 29
    IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
app/models/role.rb
49 49
  validates_presence_of :name
50 50
  validates_uniqueness_of :name
51 51
  validates_length_of :name, :maximum => 30
52
  validates_format_of :name, :with => /^[\w\s\'\-]*$/i
52
  validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
53 53

  
54 54
  def permissions
55 55
    read_attribute(:permissions) || []
app/models/tracker.rb
37 37
  validates_presence_of :name
38 38
  validates_uniqueness_of :name
39 39
  validates_length_of :name, :maximum => 30
40
  validates_format_of :name, :with => /^[\w\s\'\-]*$/i
40
  validates_format_of :name, :with => /^[[:word:][:space:]\'\-]*$/i
41 41

  
42 42
  def to_s; name end
43 43
  
app/models/user.rb
57 57
  # Login must contain lettres, numbers, underscores only
58 58
  validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
59 59
  validates_length_of :login, :maximum => 30
60
  validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i
60
  validates_format_of :firstname, :lastname, :with => /^[[:word:][:space:]\'\-\.]*$/i
61 61
  validates_length_of :firstname, :lastname, :maximum => 30
62 62
  validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
63 63
  validates_length_of :mail, :maximum => 60, :allow_nil => true
lib/redcloth3.rb
352 352
    PUNCT = Regexp::quote( '!"#$%&\'*+,-./:;=?@\\^_`|~' )
353 353
    PUNCT_NOQ = Regexp::quote( '!"#$&\',./:;=?@\\`|' )
354 354
    PUNCT_Q = Regexp::quote( '*-_+^~%' )
355
    HYPERLINK = '(\S+?)([^\w\s/;=\?]*?)(?=\s|<|$)'
355
    HYPERLINK = '(\S+?)([^[:word:][:space:]/;=\?]*?)(?=\s|<|$)'
356 356

  
357 357
    # Text markup tags, don't conflict with block tags
358 358
    SIMPLE_HTML_TAGS = [
lib/redmine/wiki_formatting/textile/formatter.rb
71 71
          toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1'
72 72
          
73 73
          # replaces non word caracters by dashes
74
          anchor = toc_item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
74
          anchor = toc_item.gsub(%r{[^[:word:][:space:]\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-')
75 75
  
76 76
          unless anchor.blank?
77 77
            if tag =~ /^h(\d)$/
lib/tasks/migrate_from_mantis.rake
88 88
      
89 89
      def firstname
90 90
        @firstname = realname.blank? ? username : realname.split.first[0..29]
91
        @firstname.gsub!(/[^\w\s\'\-]/i, '')
91
        @firstname.gsub!(/[^[:word:][:space:]\'\-]/i, '')
92 92
        @firstname
93 93
      end
94 94
      
95 95
      def lastname
96 96
        @lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29]
97
        @lastname.gsub!(/[^\w\s\'\-]/i, '')
97
        @lastname.gsub!(/[^[:word:][:space:]\'\-]/i, '')
98 98
        @lastname = '-' if @lastname.blank?
99 99
        @lastname
100 100
      end
......
228 228
      end
229 229
      
230 230
      def name
231
        read_attribute(:name)[0..29].gsub(/[^\w\s\'\-]/, '-')
231
        read_attribute(:name)[0..29].gsub(/[^[:word:][:space:]\'\-]/, '-')
232 232
      end
233 233
    end
234 234
    
lib/tasks/migrate_from_trac.rake
246 246
          ln = ($2 || '-').strip
247 247

  
248 248
          u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
249
                       :firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^\w\s\'\-]/i, '-'),
250
                       :lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^\w\s\'\-]/i, '-')
249
                       :firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^[:word:][:space:]\'\-]/i, '-'),
250
                       :lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^[:word:][:space:]\'\-]/i, '-')
251 251

  
252 252
          u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-')
253 253
          u.password = 'trac'
254
-