Skip to content

Fix broken links on help page

What does this MR do?

This merge request updates the regular expression in the help controller that prefixes relative links with /help/.

The controller needs to differentiate between

  • relative links which should be prefixed by /help/ and
  • external links which should be used as-is.

The old regular expression used a faulty look-ahead pattern which treats relative links that appear before an external link on the same line as an external link. These links are then not prefixed with /help/ and thus point to a non-existing page.

The new implementation uses a stricter look-ahead pattern following RFC 3896. The new implementation treads relative and external links on the same line correctly.

Furthermore, the new implementation is aware of the following three edge-cases:

  • Links which do not include //, e.g. mailto:mail@example.com, are treated as external links and are not prefixed with /help/ (unlike old implementation).
  • Protocol-relative links, such as //example.com/, are treated as external links and are not prefixed with /help/ (same as old implementation).
  • Relative links with https:// in the query part of the URL, such as help_page?go=https://example.com/ are treated as relative links and prefixed with /help/ (unlike old implementation).

Test cases have been added to check the listed scenarios.

What are the relevant issue numbers?

#49729 (closed), #57554 (closed)

Does this MR meet the acceptance criteria?

Closes #57554 (closed)

Merge request reports