Fix notes when path names are the same
What does this MR do and why?
Issue #487375
This fixes a bug where referencing an epic in an issue created the wrong reference link when the group name has the same name as the project.
This was because the reference used the relative path, instead of the absolute path. E.g.
- Group name:
gitlab
- Project name:
gitlab
(full path:/gitlab/gitlab
)
When mentioning an epic within the gitlab/gitlab
project,
the note generated a reference to gitlab/gitlab/issues/:iid
,
instead of /gitlab/epics/:iid
(the IID must exist in the project).
This is now fixed by using generating an absolute path as URL for the reference to mitigate the ambiguity.
References
Screenshots or screen recordings
Before | After |
---|---|
before_mentioning | after_mentioning |
How to set up and validate locally
- Create a group and project that have the same name, e.g. Group:
gitlab
, and projectgitlab
- Create an epic in the group
- Create an issue in the group
- Mention the issue in the epic with
#:iid
- Go to the mentioned issue, and check the system note that includes the mention
- Before: It doesn't link to the epic but the issue again
- After: It links to the epic
Same can be reproduced when mentioning a Merge Request in an Epic.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.