summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-12-01 17:25:12 +0000
committerAlejandro Rodríguez <alejorro70@gmail.com>2016-12-02 13:36:00 -0300
commitf087b999a71eb0b48794b54cea26638bf128104f (patch)
tree09c40c1c6cd61d6306628d04035d33d25cc095ff /app
parent3c767f06fa541587b0ade7ad6edbbe6e7f6b4470 (diff)
downloadgitlab-ce-f087b999a71eb0b48794b54cea26638bf128104f.tar.gz
Merge branch '25199-fix-broken-urls-in-help-page' into 'master'
Fix URL rewritting in the Help section Closes #25199 See merge request !7875
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