Web IDE fails to load MR coming from a fork
Summary
Web IDE fails to load an MR coming from a fork. After choosing the MR in MR switcher, web IDE stops working completely.
Related to: #23574 (closed)
Steps to reproduce
- Open Web IDE
- Use the MR switcher to open an MR that's coming from a forked project (the MR branch is not in the project)
Example Project
You can use the github-org/gitter/webapp
and try to pick a community contribution MR (e.g. https://gitlab.com/gitlab-org/gitter/webapp/-/merge_requests/1875)
What is the current bug behavior?
Web IDE tries to fetch the MR data from the current project. Gets 404 response and shows an error message and infinite loading spinner.
What is the expected correct behavior?
- Not offer MR from forks (already suggested in #23574 (closed))
- Gracefully handle 404 API response by redirecting/showing the main branch.
Relevant logs and/or screenshots
When I open the IDE for the fork MR
I see network request to
https://gitlab.com/api/v4/projects/gitlab-org%2Fgitter%2Fwebapp/repository/branches/uuttff8-develop-patch-29832
which gets 404 response, because the branch is not in gitlab-org/gitter/webapp
but in https://gitlab.com/uuttff8/webapp/-/tree/uuttff8-develop-patch-29832
Output of checks
This bug happens on GitLab.com
Possible fixes
As suggested by the expected behavior section.