Relative Links are broken on Wiki ASCII Pages
Summary
Customer has reported that their wiki pages, specifically ASCII pages have relative links that have become broken. There were no evidence of file changes that would have caused this or projects moved.
Steps to reproduce
Cannot reproduce. Customer reported and shared no change indication on their side.
Video link (internal) that demonstrates the broken links on the SaaS Namespace.
Example Project
See link on browser in video.
What is the current bug behavior?
Relative links are broken on asci wiki pages without any user change. 100s of links impacted.
What is the expected correct behavior?
Relative links should work.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
GitLab.com (Free tier). Signing at Premium Wednesday
Possible fixes
From what I've been able to determine, the problem is with fully qualified links.
With a relative link, such as link:some/other/page
, we need to add the beginning of the path, making it /flightjs/Flight/wikis/some/other/page
For a fully qualified link, we don't need to do that. For example, link:/flightjs/Flight/wikis/some/other/page
. Note that we're linking to the fully qualified path, which includes the group and project name, etc. This is the type of link the customer is using (based on the video).
With this type of link, we don't want to add anything - it's already properly specified.
The added Filter::WikiLinkFilter
should recognize this. And it does, in https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/banzai/filter/wiki_link_filter/rewriter.rb#L45
However, the @wiki_base_path
is /flightjs/Flight/-/wikis
in this case. Since we changed our routing to use a -
(many moons ago), the path is /flightjs/Flight/-/wikis
, however the customer is using the older routing without the -
, so their path is /flightjs/Flight/wikis
.
Which means we don't detect the leading base path, and add it again.
Links using the new format, /flightjs/Flight/-/wikis
work correctly. It's only those using the old format that won't.