diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-11-17 18:55:12 +0300 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2017-11-17 18:57:03 +0300 |
commit | 616242a72dfb2adead8dd9a6af6d789a39220501 (patch) | |
tree | 651a4bad7b5fd601a1deac71b2dede9062990802 /lib | |
parent | 1fe4240ca51b064868b2388f5ee0afec4ec7e08a (diff) |
Merge branch '40230-groups-gitlab-org-labels-json-redirects-to-groups-gitlab-org-labels-json' into 'master'
Resolve "/groups/gitlab-org/labels.json redirects to /groups/gitlab-org/-/labels/.json"
Closes #40230
See merge request gitlab-org/gitlab-ce!15427
(cherry picked from commit 7142af49fa5947d439c1c539140538fc740f5187)
9f921b73 Don't add a trailing slash in group redirects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/routing.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/routing.rb b/lib/gitlab/routing.rb index 910533076b0..2c994536060 100644 --- a/lib/gitlab/routing.rb +++ b/lib/gitlab/routing.rb @@ -46,10 +46,10 @@ module Gitlab # Only replace the last occurence of `path`. # # `request.fullpath` includes the querystring - path = request.path.sub(%r{/#{path}/*(?!.*#{path})}, "/-/#{path}/") - path << "?#{request.query_string}" if request.query_string.present? + new_path = request.path.sub(%r{/#{path}(/*)(?!.*#{path})}, "/-/#{path}\\1") + new_path << "?#{request.query_string}" if request.query_string.present? - path + new_path end paths.each do |path| |