Uniqueness check should be case insensitive for username and path, otherwise mysql behaves weird.
This commit is contained in:
parent
499a118590
commit
c1dddf8c7d
|
@ -27,7 +27,7 @@ class Namespace < ActiveRecord::Base
|
|||
format: { with: Gitlab::Regex.name_regex,
|
||||
message: "only letters, digits, spaces & '_' '-' '.' allowed." }
|
||||
validates :description, length: { within: 0..255 }
|
||||
validates :path, uniqueness: true, presence: true, length: { within: 1..255 },
|
||||
validates :path, uniqueness: { case_sensitive: false }, presence: true, length: { within: 1..255 },
|
||||
exclusion: { in: Gitlab::Blacklist.path },
|
||||
format: { with: Gitlab::Regex.path_regex,
|
||||
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
|
||||
|
|
|
@ -109,7 +109,7 @@ class User < ActiveRecord::Base
|
|||
validates :bio, length: { maximum: 255 }, allow_blank: true
|
||||
validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider}
|
||||
validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0}
|
||||
validates :username, presence: true, uniqueness: true,
|
||||
validates :username, presence: true, uniqueness: { case_sensitive: false },
|
||||
exclusion: { in: Gitlab::Blacklist.path },
|
||||
format: { with: Gitlab::Regex.username_regex,
|
||||
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
|
||||
|
|
Loading…
Reference in New Issue