diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 13:52:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-10 13:52:59 +0300 |
commit | cec843b2ec7535618674fc1cd00061e9d4a95b37 (patch) | |
tree | aa288ced5ece74208df396e6386b2fd51c641c96 /app | |
parent | 2dd5a5179a522b650425610cc76954e433b61c09 (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-ee
Diffstat (limited to 'app')
-rw-r--r-- | app/models/namespace/traversal_hierarchy.rb | 8 | ||||
-rw-r--r-- | app/models/user.rb | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/namespace/traversal_hierarchy.rb b/app/models/namespace/traversal_hierarchy.rb index 093b7dae246..34086a8af5d 100644 --- a/app/models/namespace/traversal_hierarchy.rb +++ b/app/models/namespace/traversal_hierarchy.rb @@ -36,7 +36,7 @@ class Namespace SET traversal_ids = cte.traversal_ids FROM (#{recursive_traversal_ids}) as cte WHERE namespaces.id = cte.id - AND namespaces.traversal_ids <> cte.traversal_ids + AND namespaces.traversal_ids::bigint[] <> cte.traversal_ids """ Namespace.transaction do @root.lock! @@ -51,7 +51,7 @@ class Namespace def incorrect_traversal_ids Namespace .joins("INNER JOIN (#{recursive_traversal_ids}) as cte ON namespaces.id = cte.id") - .where('namespaces.traversal_ids <> cte.traversal_ids') + .where('namespaces.traversal_ids::bigint[] <> cte.traversal_ids') end private @@ -66,9 +66,9 @@ class Namespace <<~SQL WITH RECURSIVE cte(id, traversal_ids, cycle) AS ( - VALUES(#{root_id}, ARRAY[#{root_id}], false) + VALUES(#{root_id}::bigint, ARRAY[#{root_id}]::bigint[], false) UNION ALL - SELECT n.id, cte.traversal_ids || n.id, n.id = ANY(cte.traversal_ids) + SELECT n.id, cte.traversal_ids || n.id::bigint, n.id = ANY(cte.traversal_ids) FROM namespaces n, cte WHERE n.parent_id = cte.id AND NOT cycle ) diff --git a/app/models/user.rb b/app/models/user.rb index 5feb3485b84..cae36ca6794 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2085,7 +2085,7 @@ class User < ApplicationRecord end def check_username_format - return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(type) } + return if username.blank? || Mime::EXTENSION_LOOKUP.keys.none? { |type| username.end_with?(".#{type}") } errors.add(:username, _('ending with MIME type format is not allowed.')) end |