Source view URL of branch name with slashes broken (e.g. "feat/foo")

Issue #14422 open
paul irish created an issue

Related issue: #408

I maintain a popular utility called git-open which opens a browser to your bitbucket/github/gitlab to view whatever branch you have checked out.

Bitbucket makes this pretty difficult if there's a slash in the branch name. (Which it surprisingly common :)

For example, in the Guyzmo/git-repo project, following the official docs I can view the devel branch with this URL:

Easy enough, but here's the problem:

For the bugfix/conftest_fix branch, bitbucket provides a 404 for a similar URL:
And we get the same result if we URL-encode the slash:

When using the site to view the branch we get a /src/<commit hash>/?at=<branch/name> URL. So while this is a workaround, it makes for more awkward ergonomics. :/

Ideally, a fix would make either of the above 404'ing URLs start to work. Thanks!

Comments (10)

  1. Amber Van Hecke staff

    Hi Paul, this should be addressed in the new source browser view that you can opt into via Bitbucket Labs in settings. I am going to close this issue, if you continue to have the problem please open another so we can determine a proper solution. Thanks

  2. Daniel Lenski

    @avanhecke, the new source browser view does not solve this problem at all

    With the new source browser view, a link of this form still does not work if the BRANCHNAME contains one or more / characters. (As @paulirish reported, URL-encoding the slash in the branch name makes no difference; still broken.)

    What made you think that the new source browser view would fix this?

    Please reopen rather than make users jump through hoops to duplicate issues that were closed erroneously!

  3. Peter Williams staff

    Hi Daniel,

    I apologize for the mixup. I believe Amber was thinking of this ticket, which is similar and which we did recently address.

    I've re-opened this ticket, as it is something we want to explore supporting as we continue to work on the new source browsing experience.

  4. Daniel Lenski

    Thanks, @peterwilliams-atl and @avanhecke.

    I've re-opened this ticket, as it is something we want to explore supporting as we continue to work on the new source browsing experience.

    It seems like the solution should be just as simple as (percent-decode the branch name from the URL" before feeding it into git rev-parse)… thereby allowing the web view to handle branch names with slashes, or any other unusual characters in them.

    E.g. decode the branch portion of so that BRANCH='feature/cr%C3%B6mul%C3%A8nt%C3%9Franchname' will lookup the Git branch named feature/crömulèntßranchname. This is the standards-compliant way of allowing / characters in URL path components.

  5. François Lauzon

    We have the same issue (need to access a branch named 'prt/feature/pr-17' for example), is there a plan to fix this?

  6. Daniel Lenski

    I believe that we might need to grab our pitchforks and torches and angrily mass outside Castle Atlassian in order to get some attention for this issue. 🤦‍♂️

    Torch-wielding mob

  7. Log in to comment