diff options
author | Rémy Coutable <remy@rymai.me> | 2019-02-12 16:56:59 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-02-12 16:56:59 +0000 |
commit | 553c9f3c2f77912bbc9d676747094e609aa96595 (patch) | |
tree | b9cebb0a29a8ed298931ec88e92390f2c139c856 /app | |
parent | b753fc6daddd9e599ff848c5347cd7fc15f6a7c4 (diff) | |
parent | 752887b9a7a8158d0c9e140d93877017e2fc2a69 (diff) | |
download | gitlab-ce-553c9f3c2f77912bbc9d676747094e609aa96595.tar.gz |
Merge branch 'fix-broken-links-in-help' into 'master'
Fix broken links on help page
Closes #57554
See merge request gitlab-org/gitlab-ce!25120
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/help_controller.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index e5a1fc9d6ff..a9d6addd4a4 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -13,9 +13,10 @@ class HelpController < ApplicationController # Remove YAML frontmatter so that it doesn't look weird @help_index = File.read(Rails.root.join('doc', 'README.md')).sub(YAML_FRONT_MATTER_REGEXP, '') - # Prefix Markdown links with `help/` unless they are external links - # See http://rubular.com/r/X3baHTbPO2 - @help_index.gsub!(%r{(?<delim>\]\()(?!.+://)(?!/)(?<link>[^\)\(]+\))}) do + # Prefix Markdown links with `help/` unless they are external links. + # '//' not necessarily part of URL, e.g., mailto:mail@example.com + # See https://rubular.com/r/DFHZl5w8d3bpzV + @help_index.gsub!(%r{(?<delim>\]\()(?!\w+:)(?!/)(?<link>[^\)\(]+\))}) do "#{$~[:delim]}#{Gitlab.config.gitlab.relative_url_root}/help/#{$~[:link]}" end end |