Skip to content

default-branch-button sometimes generates an incorrect URL when the latest version tag has a slash #6553

Closed

Description

@voidedstarlight

Description

Despite all previous fixes, it appears that the default-branch-button feature still generates an incorrect URL for the default branch in certain very specific scenarios when the following steps are performed exactly without reloading the page between steps (video demonstration at the end) in a repository where the latest version tag contains a slash:

How to replicate the issue + URL

  1. Open a repository where the latest version tag contains a slash (e.g. https://github.com/DanielMiao1/chess, https://github.com/oortcloud/meteorite);
  2. Using the Switch branches/tags dropdown menu (see figure 1), switch to any tag that is not the latest version (so that the Visit latest version button appears) (switching to a branch only sometimes reproduces the issue);
  3. Press the Visit latest version button (see figure 2);
  4. Press the See this view on the default branch button (see figure 3);
  5. The issue occurs.

On an unrelated note, it appears that the incorrect generated URLs are different depending on whether the user is logged in.
When the user is logged in, the generated URL is in the form https://github.com/user/repo///branch-name-after-slash (https://github.com/DanielMiao1/chess///patch-1 for the first example repository), while performing the same steps logged out yields a URL in the form of https://github.com/user/repo/tree/default-branch-name/branch-name-after-slash (such as https://github.com/DanielMiao1/chess/tree/main/patch-1).

Figure 1
Figure 1: The switch branches/tags dropdown menu

Figure 2
Figure 2: The latest version button

Figure 3
Figure 3: The default branch button

Full Demonstration
https://user-images.githubusercontent.com/83146190/234073340-7e120baf-6143-4c2f-a7c3-1341ebb1a42d.mp4

Extension version

23.4.15

Browser(s) used

Google Chrome 64-bit 111.0.5563.146 on macOS 13.2 (x86), Firefox Developer Edition 64-bit 112.0b8 on macOS 13.2(x86), Firefox ESR 64-bit 102.9.0esr on Debian 11.6 (arm64), Firefox 111.0.1 on Debian 11.5 (x86)

Activity

  1. fregante commented on Apr 26, 2023

    @fregante
    Member

    Thank you for the very detailed report! Interestingly this only happens when using latest-tag-button in step 3, but it works correctly when using the native branch selector to visit the same tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions