Add strict validation to snippet file names
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
9a3ae331ad
commit
f28a12a559
1 changed files with 4 additions and 2 deletions
|
@ -29,7 +29,9 @@ class Snippet < ActiveRecord::Base
|
|||
|
||||
validates :author, presence: true
|
||||
validates :title, presence: true, length: { within: 0..255 }
|
||||
validates :file_name, presence: true, length: { within: 0..255 }
|
||||
validates :file_name, presence: true, length: { within: 0..255 },
|
||||
format: { with: Gitlab::Regex.path_regex,
|
||||
message: Gitlab::Regex.path_regex_message }
|
||||
validates :content, presence: true
|
||||
validates :visibility_level, inclusion: { in: Gitlab::VisibilityLevel.values }
|
||||
|
||||
|
|
Loading…
Reference in a new issue