gentoo-overlay/www-apps/gitlabhq/files/gitlabhq-6.0.2-fix-project-name-regex.patch

33 lines
1.2 KiB
Diff
Raw Normal View History

diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index b4be46d..2120f5a 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+
module Gitlab
module Regex
extend self
@@ -7,7 +9,7 @@ module Gitlab
end
def project_name_regex
- /\A[a-zA-Z0-9][a-zA-Z0-9_\-\. ]*\z/
+ /\A\p{Word}[\p{Word}\-:\. ]*\z/
end
def name_regex
diff --git a/app/models/project.rb b/app/models/project.rb
index d8fa6cb..c4e5427 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -73,7 +73,7 @@ class Project < ActiveRecord::Base
validates :description, length: { within: 0..2000 }
validates :name, presence: true, length: { within: 0..255 },
format: { with: Gitlab::Regex.project_name_regex,
- message: "only letters, digits, spaces & '_' '-' '.' allowed. Letter or digit should be first" }
+ message: "only letters, digits, spaces & '_' '-' '.' ':' allowed. Letter or digit should be first" }
validates :path, presence: true, length: { within: 0..255 },
exclusion: { in: Gitlab::Blacklist.path },
format: { with: Gitlab::Regex.path_regex,