Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-11-10 02:31:26 +0300
committerStan Hu <stanhu@gmail.com>2018-11-10 02:36:45 +0300
commit39f252254b535e58fe50e722a4ba5d95b17fc90d (patch)
treedd7312cab3c2f07247112c852ea92c205a21c2c0 /lib/banzai
parent4aa41d07e16ca03f5f56b7cc5c136d86d51666c2 (diff)
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
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/absolute_link_filter.rb1
1 files changed, 1 insertions, 0 deletions
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