[go: up one dir, main page]

URL is broken when switching from branch with longer name to branch with shorter name in Gitlab Web GUI

Summary

Any project with branches named with similar initials like [ development and dev ] or [ production and prod ] will have issues when switching from branch with a longer name to branch with a shorter name for example [ development to dev ] or [ production to dev ] branch in the Gitlab Web GUI.

Steps to reproduce

  1. Create a gitlab project
  2. Create a branch "development" from master
  3. Create another branch "dev"
  4. Switch to "development" branch from the dropdown in the Repository/Commits section of Gitlab Web GUI
  5. Switch to "dev" branch

Example Project

https://gitlab.com/edocabhi/gitlab-bug

Reproducing in Sample Project
  1. Visit https://gitlab.com/edocabhi/gitlab-bug/-/commits/production
  2. Switch to dev or prod branch from the dropdown

What is the current bug behavior?

  • When the switch is done in Repository/Commits section it takes the user to 404 page.
  • When the switch is done in Repository/Files section it gives an information bar for nonexistent path as shown in attached screenshot
  1. Initially when in development branch the URL will look like this https://gitlab.com/ativiti1/ativiti/-/commits/development

  2. When switched to dev branch the URL becomes https://gitlab.com/ativiti1/ativiti/-/commits/dev/lopment

  3. Similarly switching from production to dev results in another broken URL https://gitlab.com/edocabhi/gitlab-bug/-/commits/dev/ction

Behavior Summary: When switching from a long branch name to a shorter branch name the trailing character is attached to the new URL and thus making it a broken URL

What is the expected correct behavior?

The branch should be switched seamlessly without any issues

Relevant logs and/or screenshots

Screen_Shot_2021-02-24_at_21.19.51

Possible Fix

The URL generator for switching branches needs to be adapted and the trailing characters from the referral link need to be removed from the newly generated URL

Edited by edocabhi