summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-12-01 12:07:52 +0100
committerRémy Coutable <remy@rymai.me>2016-12-01 16:40:48 +0100
commit633538151b99c658bcbb2173e91eb5deba4408f7 (patch)
treea1b160554e8fb94a40ef3176e86128b0cbdeef28 /app
parent507abdb7739c2c6df49cee77c966c4db0dcaf1bb (diff)
downloadgitlab-ce-633538151b99c658bcbb2173e91eb5deba4408f7.tar.gz
Fix URL rewritting in the Help section25199-fix-broken-urls-in-help-page
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app')
-rw-r--r--app/controllers/help_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index a10cdcce72b..37feff79999 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -7,8 +7,10 @@ class HelpController < ApplicationController
@help_index = File.read(Rails.root.join('doc', 'README.md'))
# Prefix Markdown links with `help/` unless they are external links
- # See http://rubular.com/r/MioSrVLK3S
- @help_index.gsub!(%r{(\]\()(?!.+://)([^\)\(]+\))}, '\1/help/\2')
+ # See http://rubular.com/r/X3baHTbPO2
+ @help_index.gsub!(%r{(?<delim>\]\()(?!.+://)(?!/)(?<link>[^\)\(]+\))}) do
+ "#{$~[:delim]}#{Gitlab.config.gitlab.relative_url_root}/help/#{$~[:link]}"
+ end
end
def show