Commit c1dddf8c7d947691729f6d64a8ea768b5c915855
1 parent
499a1185
Exists in
spb-stable
and in
3 other branches
Uniqueness check should be case insensitive for username and path, otherwise mysql behaves weird.
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/models/namespace.rb
... | ... | @@ -27,7 +27,7 @@ class Namespace < ActiveRecord::Base |
27 | 27 | format: { with: Gitlab::Regex.name_regex, |
28 | 28 | message: "only letters, digits, spaces & '_' '-' '.' allowed." } |
29 | 29 | validates :description, length: { within: 0..255 } |
30 | - validates :path, uniqueness: true, presence: true, length: { within: 1..255 }, | |
30 | + validates :path, uniqueness: { case_sensitive: false }, presence: true, length: { within: 1..255 }, | |
31 | 31 | exclusion: { in: Gitlab::Blacklist.path }, |
32 | 32 | format: { with: Gitlab::Regex.path_regex, |
33 | 33 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |
app/models/user.rb
... | ... | @@ -109,7 +109,7 @@ class User < ActiveRecord::Base |
109 | 109 | validates :bio, length: { maximum: 255 }, allow_blank: true |
110 | 110 | validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} |
111 | 111 | validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} |
112 | - validates :username, presence: true, uniqueness: true, | |
112 | + validates :username, presence: true, uniqueness: { case_sensitive: false }, | |
113 | 113 | exclusion: { in: Gitlab::Blacklist.path }, |
114 | 114 | format: { with: Gitlab::Regex.username_regex, |
115 | 115 | message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" } | ... | ... |