Viewing a file and have a line selected, switching branch redirects to project's home page.
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary While viewing a file, if one switches a branch while a line is selected (that is, there exist `#L<n>` in the URL in the address box), the page cannot find the file. ### Steps to reproduce 1. Go to some project which has at least 2 branches containing the file at the same path. 2. Open the file. Then, select a line by clicking the line number on the left. Notice that `#L<n>` (where `n` is a line number) appears in the address bar. 3. Switch to the other branch using the branch switcher near the top of the page. ### Example Project I don't think this is project-related, but it's reproducible on https://gitlab.com/ubports/core/packaging/qtbase/-/tree/ubports/xenial_-_qt-5-12 ### What is the current *bug* behavior? The UI will redirect to the project's homepage citing `"<filename>#L<n>" doesn't exist on <branch>.`, even though the file does exist. ### What is the expected *correct* behavior? The UI should display the content of that file in a different branch, preferably at the selected line. ### Relevant logs and/or screenshots ![image](/uploads/c5f0970ca96f6d959f6877451a9b87c1/image.png) ### Output of checks <!-- If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com --> This bug happens on GitLab.com
issue