summaryrefslogtreecommitdiff
path: root/app/controllers/help_controller.rb
diff options
context:
space:
mode:
authorDavid Wagner <david@marvid.fr>2016-11-18 12:57:25 +0100
committerDavid Wagner <david@marvid.fr>2016-11-20 20:15:08 +0100
commitc4ded595ccf520bc30bde90403366ad14ba8b594 (patch)
tree0771a2f1204edae9fc03c4ffdc5bf91517a41bde /app/controllers/help_controller.rb
parent9aded5c8d43cf113b03e2d8fd04a32c4b24af24d (diff)
downloadgitlab-ce-c4ded595ccf520bc30bde90403366ad14ba8b594.tar.gz
Fix broken external links in help/index.html
An external link was recently added but was broken because 'https://gitlab.com/help/' was prepended to every link in the page. Since no link in the main help readme begins with "help" and since doing so wouldn't make sense, the substitution conditionaly prepending "help" can be simplified and reused. Signed-off-by: David Wagner <david@marvid.fr>
Diffstat (limited to 'app/controllers/help_controller.rb')
-rw-r--r--app/controllers/help_controller.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 4b3c71874be..a10cdcce72b 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -6,9 +6,9 @@ class HelpController < ApplicationController
def index
@help_index = File.read(Rails.root.join('doc', 'README.md'))
- # Prefix Markdown links with `help/` unless they already have been
- # See http://rubular.com/r/ie2MlpdUMq
- @help_index.gsub!(/(\]\()(\/?help\/)?([^\)\(]+\))/, '\1/help/\3')
+ # Prefix Markdown links with `help/` unless they are external links
+ # See http://rubular.com/r/MioSrVLK3S
+ @help_index.gsub!(%r{(\]\()(?!.+://)([^\)\(]+\))}, '\1/help/\2')
end
def show