diff options
Diffstat (limited to 'lib/constraints/repository_redirect_url_constrainer.rb')
-rw-r--r-- | lib/constraints/repository_redirect_url_constrainer.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/constraints/repository_redirect_url_constrainer.rb b/lib/constraints/repository_redirect_url_constrainer.rb index 44df670d8d3..046b3397152 100644 --- a/lib/constraints/repository_redirect_url_constrainer.rb +++ b/lib/constraints/repository_redirect_url_constrainer.rb @@ -18,11 +18,17 @@ module Constraints end # Check if the path matches any known repository containers. - # These also cover wikis, since a `.wiki` suffix is valid in project/group paths too. def container_path?(path) - NamespacePathValidator.valid_path?(path) || + wiki_path?(path) || ProjectPathValidator.valid_path?(path) || path =~ Gitlab::PathRegex.full_snippets_repository_path_regex end + + private + + # These also cover wikis, since a `.wiki` suffix is valid in project/group paths too. + def wiki_path?(path) + NamespacePathValidator.valid_path?(path) && path.end_with?('.wiki') + end end end |