Fix inline blame previous-blame link on relative URL installs
What does this MR do and why?
Fixes a bug in the inline blame view where the "View blame prior to this change" button links to a URL missing the relative URL root prefix, resulting in a 404 on instances installed under a relative path (e.g., https://example.com/gitlab).
The root cause was in previousBlameUrl computed prop in app/assets/javascripts/vue_shared/components/source_viewer/components/blame_commit_info.vue. It built the href using joinPaths('/', projectPath, '-/blob', parentSha, previousPath), which produces a root-relative path that ignores gon.relative_url_root.
The fix uses the projectBlobPath route helper from ~/lib/utils/path_helpers/repository instead. Route helpers are globally configured with script_name: gon.relative_url_root (in app/assets/javascripts/behaviors/configure_path_helpers.js), so the relative URL root is automatically applied. The ?blame=1 query parameter is passed as a route option.
References
Resolves #627734 (closed)
Related: !245993 (merged)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Configure a relative URL root. In GDK, set
relative_url_root: /gitlabingdk.yml, then rungdk reconfigure && gdk restart. For Omnibus, setexternal_url "https://example.com/gitlab"ingitlab.rb. - Open any text file with more than one commit in its history.
- Select Blame in the file header to enable inline blame.
- Hover a blame entry and check the "View blame prior to this change" button (doc-versions icon). Its link should include the relative URL root and open the previous version's blame view instead of a 404.
MR acceptance checklist
This MR is expected to adhere to the acceptance checklist. The checklist has been evaluated.