summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/constraints/project_url_constrainer.rb4
-rw-r--r--lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb7
-rw-r--r--lib/gitlab/etag_caching/router.rb2
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/constraints/project_url_constrainer.rb b/lib/constraints/project_url_constrainer.rb
index 064e1bd78e3..d0ce2caffff 100644
--- a/lib/constraints/project_url_constrainer.rb
+++ b/lib/constraints/project_url_constrainer.rb
@@ -4,9 +4,7 @@ class ProjectUrlConstrainer
project_path = request.params[:project_id] || request.params[:id]
full_path = namespace_path + '/' + project_path
- unless DynamicPathValidator.valid?(full_path)
- return false
- end
+ return false unless DynamicPathValidator.valid?(full_path)
Project.find_by_full_path(full_path).present?
end
diff --git a/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb b/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
index 4937dfe2d31..4143e0edc62 100644
--- a/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
+++ b/lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
@@ -11,13 +11,14 @@ module Gitlab
end
def namespaces_for_paths(type:)
- namespaces = if type == :wildcard
+ namespaces = case type
+ when :wildcard
MigrationClasses::Namespace.where.not(parent_id: nil)
- elsif type == :top_level
+ when :top_level
MigrationClasses::Namespace.where(parent_id: nil)
end
with_paths = MigrationClasses::Route.arel_table[:path].
- matches_any(path_patterns)
+ matches_any(path_patterns)
namespaces.joins(:route).where(with_paths)
end
diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb
index c7da8b07a56..aac210f19e8 100644
--- a/lib/gitlab/etag_caching/router.rb
+++ b/lib/gitlab/etag_caching/router.rb
@@ -8,7 +8,7 @@ module Gitlab
# regex itself)
# - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route
# - Ending in `issues/id`/rendered_title` for the `issue_title` route
- USED_IN_ROUTES = %w[noteable issue notes issues renderred_title
+ USED_IN_ROUTES = %w[noteable issue notes issues rendered_title
commit pipelines merge_requests new].freeze
RESERVED_WORDS = DynamicPathValidator::WILDCARD_ROUTES - USED_IN_ROUTES
RESERVED_WORDS_REGEX = Regexp.union(*RESERVED_WORDS)