diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-06-14 16:37:53 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-06-15 19:05:03 +0300 |
commit | a2fd106b04f61f14772a9deebb5ac7a23b2dc6e1 (patch) | |
tree | f7aaabe94bc58fd099398f0c26fa02aeb64ede8c /lib | |
parent | fb9fb54045fbf51c961f3212444c075db2b1a6e2 (diff) |
Merge branch 'zj-raise-etag-route-regex-miss' into 'master'
Raise etag route regex miss
Closes #33106
See merge request !12084
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/etag_caching/middleware.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/etag_caching/router.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/etag_caching/store.rb | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/etag_caching/middleware.rb b/lib/gitlab/etag_caching/middleware.rb index 7f884183bb1..1d6f5bb5e1c 100644 --- a/lib/gitlab/etag_caching/middleware.rb +++ b/lib/gitlab/etag_caching/middleware.rb @@ -7,7 +7,7 @@ module Gitlab def call(env) request = Rack::Request.new(env) - route = Gitlab::EtagCaching::Router.match(request) + route = Gitlab::EtagCaching::Router.match(request.path_info) return @app.call(env) unless route track_event(:etag_caching_middleware_used, route) diff --git a/lib/gitlab/etag_caching/router.rb b/lib/gitlab/etag_caching/router.rb index dccc66b3918..75167a6b088 100644 --- a/lib/gitlab/etag_caching/router.rb +++ b/lib/gitlab/etag_caching/router.rb @@ -53,8 +53,8 @@ module Gitlab ) ].freeze - def self.match(request) - ROUTES.find { |route| route.regexp.match(request.path_info) } + def self.match(path) + ROUTES.find { |route| route.regexp.match(path) } end end end diff --git a/lib/gitlab/etag_caching/store.rb b/lib/gitlab/etag_caching/store.rb index 0039fc01c8f..072fcfc65e6 100644 --- a/lib/gitlab/etag_caching/store.rb +++ b/lib/gitlab/etag_caching/store.rb @@ -25,6 +25,8 @@ module Gitlab end def redis_key(key) + raise 'Invalid key' if !Rails.env.production? && !Gitlab::EtagCaching::Router.match(key) + "#{REDIS_NAMESPACE}#{key}" end end |