summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-11-09 15:31:26 -0800
committerStan Hu <stanhu@gmail.com>2018-11-09 15:36:45 -0800
commit39f252254b535e58fe50e722a4ba5d95b17fc90d (patch)
treedd7312cab3c2f07247112c852ea92c205a21c2c0 /app/helpers
parent4aa41d07e16ca03f5f56b7cc5c136d86d51666c2 (diff)
downloadgitlab-ce-39f252254b535e58fe50e722a4ba5d95b17fc90d.tar.gz
Make sure there's only one slash as path separatorsh-53180-append-path
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 'app/helpers')
-rw-r--r--app/helpers/import_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/helpers/import_helper.rb b/app/helpers/import_helper.rb
index 3d0eb3d0d51..49171df1433 100644
--- a/app/helpers/import_helper.rb
+++ b/app/helpers/import_helper.rb
@@ -83,7 +83,7 @@ module ImportHelper
private
def github_project_url(full_path)
- URI.join(github_root_url, full_path).to_s
+ Gitlab::Utils.append_path(github_root_url, full_path)
end
def github_root_url
@@ -95,6 +95,6 @@ module ImportHelper
end
def gitea_project_url(full_path)
- URI.join(@gitea_host_url, full_path).to_s
+ Gitlab::Utils.append_path(@gitea_host_url, full_path)
end
end