Skip to content

Change wiki to not encode slashes in URI slug for API call

What does this MR do and why?

Related to #469224 (closed).

This lets the wiki API endpoints to take the slug argument without escaping slashes in the slug, which fixes wiki actions on some reverse proxy setups where escaping slashes in requests is not allowed.

Grape API routing doesn't support named wildcard arguments in a route (if it does somehow, it's poorly documented), but a blanket regex constraint seems to do the job just fine and matches to / slashes as well for the whole segment at the end of the route.

This is already covered by existing wiki endpoint shared examples, but I added a new test specifically for subpages.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Visit any wiki page that is a subpage (has a slug with a slash) and check the requests made from the browser.
  2. Note that the slashes in the slug in the request URI aren't escaped into %2F anymore.
Edited by Piotr Skorupa

Merge request reports

Loading