diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-11-07 15:04:46 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-11-07 21:52:10 +0300 |
commit | 2414c69ee981cf6432e513dfdcf57a9badc5d51f (patch) | |
tree | 668a369dce88fd852d1601b8d5d223948d167071 /lib | |
parent | e070e216c80efb897eb6c5a7d13872e4762205c1 (diff) |
Check redirecting with a querystring
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/routing.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb index defb47663cb..910533076b0 100644 --- a/lib/gitlab/routing.rb +++ b/lib/gitlab/routing.rb @@ -44,8 +44,10 @@ module Gitlab def self.redirect_legacy_paths(router, *paths) build_redirect_path = lambda do |request, _params, path| # Only replace the last occurence of `path`. - path = request.fullpath.sub(%r{/#{path}/*(?!.*#{path})}, "/-/#{path}/") - path << request.query_string if request.query_string.present? + # + # `request.fullpath` includes the querystring + path = request.path.sub(%r{/#{path}/*(?!.*#{path})}, "/-/#{path}/") + path << "?#{request.query_string}" if request.query_string.present? path end |