Fix bug in wiki link rewriter filter
What does this MR do?
There is a bug in the wiki link filter when the link is relative and it points to the url. Instead of avoiding prepeding the wiki base path we do it twice resulting in links like: /foo/bar/-/wikis//foo/bar/-/wikis/uploads/72bda26c98be192882344365b1796e00/file.png
In this MR we fix that by detecting if the wiki base path is already present.
Steps to reproduce
The bug can be easily reproduced using Gollum Tags. These are the steps:
- Edit a wiki page
- Upload an image attachment. A resulting route like this
uploads/530525687890586e4ac0996315bdfd0a/file.png
will be added - Then add the following:
* [[uploads/530525687890586e4ac0996315bdfd0a/file.png]]
(using the attachment relative path)
The image won't be displayed and if we inspect the url we will see something like:
Where we can see that the absolute path is repeated twice.
Disclaimer: After this fix the image won't be displayed because there is another bug that I'm fixing in !56638 (merged) but if we inspect the element, the url should be right.
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Separation of EE specific content
Edited by Francisco Javier López