summaryrefslogtreecommitdiff
path: root/lib/gitlab/routing.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-11-07 13:04:46 +0100
committerBob Van Landuyt <bob@vanlanduyt.co>2017-11-07 19:52:10 +0100
commit2414c69ee981cf6432e513dfdcf57a9badc5d51f (patch)
tree668a369dce88fd852d1601b8d5d223948d167071 /lib/gitlab/routing.rb
parente070e216c80efb897eb6c5a7d13872e4762205c1 (diff)
downloadgitlab-ce-2414c69ee981cf6432e513dfdcf57a9badc5d51f.tar.gz
Check redirecting with a querystring
Diffstat (limited to 'lib/gitlab/routing.rb')
-rw-r--r--lib/gitlab/routing.rb6
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