Can't link to latest commit of a branch

AJ Steers September 14, 2020

FYI - I also filed a ticket on this page:

https://support.atlassian.com/bitbucket-cloud/docs/hyperlink-to-source-code-in-bitbucket/

 

The instructions do not work when trying to link to the latest commit on a specific branch. It seems only master/main branches can be linked using the 'commitish' argument - if I try my branch name (feature/diagrams, even with the '/' escaped), I receive a 404 error.

This is a constant struggle as I try to share documentation and other work-in-progress files with team members, since the links are immediately stale as soon as I commit a new update to the file in question.

 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 16, 2020

Hi AJ,

I believe this is due to a bug with the URL of branch names that contain a slash character:

If a branch name doesn't contain a slash, then its source code can be accessed via the link:

https://bitbucket.org/<workspace-id>/<repo-slug>/src/<branch-name>/

However, the link above will give a 404 for branches with a slash in their name. I believe this is the reason why the branch name you mentioned, feature/diagrams, doesn't work in your link.

The workaround in this case would be to replace the branch name in your link with the commit hash, however this means that the URL should get updated if there is a new commit that changes this file.

I would suggest adding yourself as a watcher in the public bug report (by selecting the Start watching this issue link) if you'd like to get notified via email on any updates. You can also select the This affects my team link to indicate you are affected by this issue

The last comment in the public bug report is from one of Bitbucket managers and mentions that our development team is working on this, but we don't have an ETA to share at the moment.

Kind regards,
Theodora

AJ Steers September 16, 2020

Thanks, @Theodora Boudale. Your explanation is perfect.

I've followed your advice to flag my team as affected, and I've added myself as a watcher on that bug.

 

Any chance the docs page could be updated also to reflect "/" characters not being supported?: https://support.atlassian.com/bitbucket-cloud/docs/hyperlink-to-source-code-in-bitbucket/ 

 

It is standard practice to group branches under a "somthing/" prefix, so it seems a pretty large omission to not have this called out in the docs.

 

Thanks very much for your quick response!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events