summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-07-06 13:44:45 +0100
committerSean McGivern <sean@gitlab.com>2018-07-06 13:44:45 +0100
commit25664f89acc1f25228e97a5169f0e7255124df2a (patch)
tree07431594054b2682e28f8978649d0abd6941ef92 /lib
parent827712e78ebb645bc7250f927de99c5f3395368f (diff)
downloadgitlab-ce-25664f89acc1f25228e97a5169f0e7255124df2a.tar.gz
Don't include a double slash when rewriting the URL
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/hook_data/base_builder.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitlab/hook_data/base_builder.rb b/lib/gitlab/hook_data/base_builder.rb
index da0f4e6105e..1e90a2b3fe1 100644
--- a/lib/gitlab/hook_data/base_builder.rb
+++ b/lib/gitlab/hook_data/base_builder.rb
@@ -22,7 +22,10 @@ module Gitlab
markdown_text.gsub(MARKDOWN_SIMPLE_IMAGE) do
if $~[:image]
- "![#{$~[:title]}](#{Gitlab.config.gitlab.url}/#{$~[:url]})"
+ url = $~[:url]
+ url = "/#{url}" unless url.start_with?('/')
+
+ "![#{$~[:title]}](#{Gitlab.config.gitlab.url}#{url})"
else
$~[0]
end