Use NamespaceValidator::WILDCARD_ROUTES in ETag caching middleware

NamespaceValidator::WILDCARD_ROUTES is less restrictive than
ProjectPathValidator::RESERVED and we really have to avoid only
routes that contain wildcard names.
This commit is contained in:
Adam Niedzielski 2017-04-05 15:48:05 +02:00
parent d4349ba6c4
commit 63a6453c01

View file

@ -1,7 +1,7 @@
module Gitlab
module EtagCaching
class Middleware
RESERVED_WORDS = ProjectPathValidator::RESERVED.map { |word| "/#{word}/" }.join('|')
RESERVED_WORDS = NamespaceValidator::WILDCARD_ROUTES.map { |word| "/#{word}/" }.join('|')
ROUTE_REGEXP = Regexp.union(
%r(^(?!.*(#{RESERVED_WORDS})).*/noteable/issue/\d+/notes\z)
)