summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-04-05 15:41:00 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-01 11:14:24 +0200
commit74fcccaab30ac0f9e11ed9a076c008ade13a50d0 (patch)
treee3341f6aa020659655b2b6941fe8660befe315bf /app/models/project.rb
parent536f2bdfd17ac3bab38851de2973dd1c89dccc3f (diff)
downloadgitlab-ce-74fcccaab30ac0f9e11ed9a076c008ade13a50d0.tar.gz
Streamline the path validation in groups & projects
`Project` uses `ProjectPathValidator` which is now a `NamespaceValidator` that skips the format validation. That way we're sure we are using the same collection of reserved paths. I updated the path constraints to reflect the changes: We now allow some values that are only used on a top level namespace as a name for a nested group/project.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index c7dc562c238..205b080c353 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -199,10 +199,11 @@ class Project < ActiveRecord::Base
project_path: true,
length: { maximum: 255 },
format: { with: Gitlab::Regex.project_path_regex,
- message: Gitlab::Regex.project_path_regex_message }
+ message: Gitlab::Regex.project_path_regex_message },
+ uniqueness: { scope: :namespace_id }
+
validates :namespace, presence: true
validates :name, uniqueness: { scope: :namespace_id }
- validates :path, uniqueness: { scope: :namespace_id }
validates :import_url, addressable_url: true, if: :external_import?
validates :import_url, importable_url: true, if: [:external_import?, :import_url_changed?]
validates :star_count, numericality: { greater_than_or_equal_to: 0 }