Commit 2088d2eba86878dafaa69e8b908a0db2730451b4

Authored by Nihad Abbasov
1 parent c7a1779b

replace ^ and $ anchors in regexp with \A and \z respectively

http://guides.rubyonrails.org/security.html#regular-expressions
Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
app/models/project.rb
@@ -75,10 +75,10 @@ class Project < ActiveRecord::Base @@ -75,10 +75,10 @@ class Project < ActiveRecord::Base
75 validates :description, length: { within: 0..2000 } 75 validates :description, length: { within: 0..2000 }
76 validates :name, uniqueness: true, presence: true, length: { within: 0..255 } 76 validates :name, uniqueness: true, presence: true, length: { within: 0..255 }
77 validates :path, uniqueness: true, presence: true, length: { within: 0..255 }, 77 validates :path, uniqueness: true, presence: true, length: { within: 0..255 },
78 - format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, 78 + format: { with: /\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/,
79 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } 79 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
80 validates :code, presence: true, uniqueness: true, length: { within: 1..255 }, 80 validates :code, presence: true, uniqueness: true, length: { within: 1..255 },
81 - format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, 81 + format: { with: /\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/,
82 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } 82 message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
83 validates :issues_enabled, :wall_enabled, :merge_requests_enabled, 83 validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
84 :wiki_enabled, inclusion: { in: [true, false] } 84 :wiki_enabled, inclusion: { in: [true, false] }