Skip to content

Resolve "Relative Links are broken on Wiki ASCII Pages"

What does this MR do and why?

In a wiki, when determining if a link should have the wiki's base path added to it, we only check for the newer style path, with a /-/ in it. However some wikis, still have links with the original wiki path. This can result in the base path being prepended when it shouldn't be.

For example, when the wiki_base_path is http://ee.gitlab.test:5100/flightjs/Flight/-/wikis/, then a link such as ![page](some/other/page) will have it's link rewritten to http://ee.gitlab.test:5100/flightjs/Flight/-/wikis/some/other/page

If the link is ![page](/flightjs/Flight/-/wikis/some/other/page), then we detect the leading base path and do not change the link.

If the link is ![page](/flightjs/Flight/wikis/some/other/page), without the /-/ portion of the route, we incorrectly prepended then base path, resulting in ![page](/flightjs/Flight/-/wikis/flightjs/Flight/wikis/some/other/page)

This is now fixed.

How to set up and validate locally

  1. creat a wiki page at some/other/page

  2. edit the wiki home page and add the following links (assuming the wiki home page is at http://ee.gitlab.test:5100/flightjs/Flight/-/wikis/home)

    [no base path](some/other/page)
    
    [newer base path](/flightjs/Flight/-/wikis/some/other/page)
    
    [old style base path](/flightjs/Flight/wikis/some/other/page)
  3. clink on each link and verify they all end up on the same page. The third, old style link will get redirected to the new route

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #377976 (closed)

Edited by Brett Walker

Merge request reports