Skip to content

Fix redirect to docs.gitlab.com when no custom doc_url is configured

Thomas Hutterer requested to merge 467939-fix-docs-redirect into master

What does this MR do and why?

Fixes #467939 (closed). Redirect to docs.gitlab.com is broken on self-managed when no custom doc_url is configured.

This bug wasn't caught be the controller spec, since (for some reason idk) we set the "custom" base_url for docs in our specs to https://docs.gitlab.com, so the spec for that redirect worked. But on self-managed, this isn't configured as such out-of-the-box but has to be set manually.

The fix is to explicitely fall back to || Gitlab::Saas.doc_url (which points to docs.gitlab.com) if nothing is manually set neither in the config yml, nor the settings db.

Changelog: fixed

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

Before After
recording_1718717849 recording_1718717984

How to set up and validate locally

  • At http://gdk.test:3000/admin/application_settings/preferences, make sure Help page > Documentation pages URL is not set.
  • Open the left sidebar, and click Help > Documentation. This should redirect to docs.gitlab.com
  • Verify that when a custom URL is set for Documentation pages URL, this URL is used for the redirect.
Edited by Thomas Hutterer

Merge request reports