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/gitlab/gon_helper.rb
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/gitlab/gon_helper.rb')
-rw-r--r--lib/gitlab/gon_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb
index 860c39feb64..15137140639 100644
--- a/lib/gitlab/gon_helper.rb
+++ b/lib/gitlab/gon_helper.rb
@@ -8,7 +8,10 @@ module Gitlab
def add_gon_variables
gon.api_version = 'v4'
- gon.default_avatar_url = URI.join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
+ gon.default_avatar_url =
+ Gitlab::Utils.append_path(
+ Gitlab.config.gitlab.url,
+ ActionController::Base.helpers.image_path('no_avatar.png'))
gon.max_file_size = Gitlab::CurrentSettings.max_attachment_size
gon.asset_host = ActionController::Base.asset_host
gon.webpack_public_path = webpack_public_path