Imported projects contain old URLs for merge request version links
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
The comparison URLs for merge request versions are hard-coded in a project export (tree/project/merge_requests.ndjson
file > [Compare with previous version](…)
Markdown links) and aren't updated when importing to a different namespace or project name.
Related to a Premium customer's internal ticket.
Steps to reproduce
- Create a test project, and a test MR with multiple commits, so that the
Compare with previous version
link appears in the MRs event list. - Export the project.
- Import it into a different namespace and/or with a different project name.
- Check the URL of the
Compare with previous version
link
Example Project
https://gitlab.com/gitlab-gold/katrinleinweber-are-mr-versions-imported/-/merge_requests/1
What is the current bug behavior?
The Compare with previous version
links contain the old …/…namespace…/…project…naame…/-/merge_requests/…
URL and leads to a 404
error.
What is the expected correct behavior?
The URL is valid. Namespace and project name are updated upon or after import, or re-generated on page load.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Possible fixes
- Skipping the ex- or import of those notes, because the underlying MR versions aren't currently ex- or imported either.
- Implementing the MR version ex- & import, plus:
- Not writing the current namespace & project name into the note content in /app/services/system_notes/commit_service.rb
- Adding a test for the current namespace & project name to spec/services/system_notes/commit_service_spec.rb
- Adding a
merge_request_version
item or so to lib/gitlab/import_export/project/import_export.yml