diff options
Diffstat (limited to 'lib/gitlab/utils.rb')
-rw-r--r-- | lib/gitlab/utils.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb index 8bd4cd2401d..b92e7dbb725 100644 --- a/lib/gitlab/utils.rb +++ b/lib/gitlab/utils.rb @@ -83,7 +83,11 @@ module Gitlab # Append path to host, making sure there's one single / in between def append_path(host, path) - "#{host.to_s.sub(%r{\/+$}, '')}/#{path.to_s.sub(%r{^\/+}, '')}" + "#{host.to_s.sub(%r{\/+$}, '')}/#{remove_leading_slashes(path)}" + end + + def remove_leading_slashes(str) + str.to_s.sub(%r{^/+}, '') end # A slugified version of the string, suitable for inclusion in URLs and |