diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-01 12:07:52 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-01 16:40:48 +0100 |
commit | 633538151b99c658bcbb2173e91eb5deba4408f7 (patch) | |
tree | a1b160554e8fb94a40ef3176e86128b0cbdeef28 /app/controllers/help_controller.rb | |
parent | 507abdb7739c2c6df49cee77c966c4db0dcaf1bb (diff) | |
download | gitlab-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/controllers/help_controller.rb')
-rw-r--r-- | app/controllers/help_controller.rb | 6 |
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 |