Commit 2088d2eb authored by Nihad Abbasov's avatar Nihad Abbasov

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

http://guides.rubyonrails.org/security.html#regular-expressions
parent c7a1779b
...@@ -75,10 +75,10 @@ class Project < ActiveRecord::Base ...@@ -75,10 +75,10 @@ class Project < ActiveRecord::Base
validates :description, length: { within: 0..2000 } validates :description, length: { within: 0..2000 }
validates :name, uniqueness: true, presence: true, length: { within: 0..255 } validates :name, uniqueness: true, presence: true, length: { within: 0..255 }
validates :path, 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" } message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
validates :code, presence: true, uniqueness: true, length: { within: 1..255 }, 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" } message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
validates :issues_enabled, :wall_enabled, :merge_requests_enabled, validates :issues_enabled, :wall_enabled, :merge_requests_enabled,
:wiki_enabled, inclusion: { in: [true, false] } :wiki_enabled, inclusion: { in: [true, false] }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment