Relative links in markdown files always resolve to main branch

Issue #16322 resolved
Spaceport created an issue

This issue appears to me as a not resolved.

Currently, relative links work only within master branch.


  1. I have a documentation branch, where I just introduced new images. There were no images in commits tree previously.
  2. I committed my changes, but all images appears to be broken.
  3. I have <doc1> commit hash in my documentation branch and <master1> in my master branch.
  4. All rendered images links in documentation branch should be pointing to raw <doc1> commit hash. But NO! They are pointing to raw <master1> commit hash. Which isn't a proper behavior.

Summary: It is necessary to render image links according to a branch where the changes are made. But not from master branch permanently.

Similar issues:

Official response

Comments (14)

  1. Nick Reilingh

    Same here, and suggest that the issue title be clarified to say "non-default branches".

    To put a finer point on it: when you include a bit of markdown in a README like ![Utility Parameters](README/Utility_parameters.png), which points to an image in a folder named README at the root of the repo, this is rendered in Bitbucket with the following src URL:<master branch HEAD commit hash>/README/Utility_parameters.png?token=<token>

    It does this even if you are looking at a branch different from master, in which case the links will likely break because the files don't yet exist in the master branch. Instead, the generated URLs should point to the same commit hash whose content you are viewing.

  2. Daniel Tao staff

    This issue is fixed!

    Note that for pages that you have recently viewed, you may need to refresh the page with caching disabled to see links and images that were previously broken.

  3. Log in to comment