"Open in Web IDE" fails to load files if clicked while browsing a repository at a specific commit
Summary
When viewing a commit and going directly to the repository page, the id of the commit is retained in the url and gets set as the branch. As there is no branch with that name an error occurs when trying to edit said branch.
Steps to reproduce
- View a source code file at a specific commit (not a branch). You can get here by any of the following:
- Browsing the repository starting from a commit.
-
Directly configuring the source code viewer to show you a file at a certain revision, by either:
- Selecting a commit from the dropdown.
- Getting a permalink to a file by pressing the
y
keyboard shortcut.
-
Viewing a file in an MR:
- Openi the Changes tab.
- Select the three-dots menu on a file.
- Select "View file @ " (the first option).
- Select "Open in Web IDE" and try to edit a file. An error message is shown.
What is the current bug behavior?
When going from a commit to repository page the branch is set to id of that commit, and the IDE can't load files for editing.
What is the expected correct behavior?
When going from a commit to repository page the branch is set correctly and the IDE can be used to edit the file.
Reproduction steps
- Visit https://gitlab.com/gitlab-org/gitlab/-/tree/b69b567e95393f73d900415d43b17c7dd126a8da
- Click on WebIDE button
- Select gitlab file on the left
Edited by Connor Gilbert