Add requested_path to readmeHtml field resolver
What does this MR do and why?
When trying to load an image from a relative path in a catalog version's README, the links appear to be broken.
This is happening because somewhere in the markup/down processing code we are losing the requested_path
for the image, which is needed in order for it to be rendered raw
and displayed properly.
This MR is the smallest change to fix the images - it simply adds a postprocess
option to the markdown
method in MarkupHelper
that merges the missing requested_path
value with the postprocessing_context
before sending it to the Markup::RenderingService
.
Further investigation along with a refactoring will be done in an immediate follow up: #460462 (closed). In this refactoring we will also be using a proper markdown_field
in GraphQL and cache the markdown for performance with a database migration.
Resolves: #455516 (closed)
Screenshots or screen recordings
Before
Note that this only happens with relative links, the second image is not relative:
After
Image shows up whatever the path is:
How to set up and validate locally
In a project marked as a catalog resource, include an image with a relative path in the README and make a release.
For an example, you can see gitlab.com/components/ruby. The README in the project looks totally fine, but if you go to the latest release's README: https://gitlab.com/explore/catalog/components/ruby, you will be able to see the broken links.