diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-09-26 23:32:04 -0700 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-09-27 02:56:20 -0700 |
commit | 2088d2eba86878dafaa69e8b908a0db2730451b4 (patch) | |
tree | 013a3a1cb0809aecb90c0019e7a24f58ea49a2cc | |
parent | c7a1779b2215b1815d43c5635e026afeed8da7f4 (diff) | |
download | gitlab-ce-2088d2eba86878dafaa69e8b908a0db2730451b4.tar.gz |
replace ^ and $ anchors in regexp with \A and \z respectively
http://guides.rubyonrails.org/security.html#regular-expressions
-rw-r--r-- | app/models/project.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 5c82b7006bd..9b13de62e82 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -75,10 +75,10 @@ class Project < ActiveRecord::Base validates :description, length: { within: 0..2000 } validates :name, uniqueness: true, presence: true, length: { within: 0..255 } validates :path, uniqueness: true, presence: true, length: { within: 0..255 }, - format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, + format: { with: /\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/, message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } validates :code, presence: true, uniqueness: true, length: { within: 1..255 }, - format: { with: /^[a-zA-Z][a-zA-Z0-9_\-\.]*$/, + format: { with: /\A[a-zA-Z][a-zA-Z0-9_\-\.]*\z/, message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } validates :issues_enabled, :wall_enabled, :merge_requests_enabled, :wiki_enabled, inclusion: { in: [true, false] } |