From 39f252254b535e58fe50e722a4ba5d95b17fc90d Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 9 Nov 2018 15:31:26 -0800 Subject: Make sure there's only one slash as path separator In Ruby 2.4, `URI.join("http://test//", "a").to_s` will remove the double slash, however it's not the case in Ruby 2.5. Using chomp should work better for the intention, as we're not trying to allow things like ../ or / paths resolution. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/53180 --- lib/banzai/filter/absolute_link_filter.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/banzai') diff --git a/lib/banzai/filter/absolute_link_filter.rb b/lib/banzai/filter/absolute_link_filter.rb index 04ec568eee3..a9bdb004c4b 100644 --- a/lib/banzai/filter/absolute_link_filter.rb +++ b/lib/banzai/filter/absolute_link_filter.rb @@ -29,6 +29,7 @@ module Banzai end def absolute_link_attr(uri) + # Here we really want to expand relative path to absolute path URI.join(Gitlab.config.gitlab.url, uri).to_s end end -- cgit v1.2.3