Skip to content
Snippets Groups Projects
Commit 17ea019f authored by Andrey Kumanyaev's avatar Andrey Kumanyaev
Browse files

Add Project name validation

parent c4536ae5
No related branches found
No related tags found
1 merge request!2389Feature/add user to projects in group (issue #2298)
Loading
Loading
@@ -64,7 +64,9 @@ class Project < ActiveRecord::Base
# Validations
validates :owner, presence: true
validates :description, length: { within: 0..2000 }
validates :name, presence: true, length: { within: 0..255 }
validates :name, presence: true, length: { within: 0..255 },
format: { with: Gitlab::Regex.project_name_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
validates :path, presence: true, length: { within: 0..255 },
format: { with: Gitlab::Regex.path_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
Loading
Loading
Loading
Loading
@@ -6,6 +6,10 @@ module Gitlab
default_regex
end
 
def project_name_regex
default_regex
end
def path_regex
default_regex
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment