Hello everyone!
I am having trouble figuring out how one can reference branches with the forward slash / character in the name while making API calls.
When using URL encoding, Bitbucket will assume that the encoded forward slash (%2F) is a path parameter delimiter.
A simple example: trying to access README.md on a branch called "feature/test" with the following command will fail, as Bitbucket will try to access it on the non-existent "feature" branch, and will assume "test" is part of the path.
Request: curl '<a href="https://api.bitbucket.org/2.0/repositories/my-workspace/myrepository/src/feature%2Ftest/README.md" target="_blank" rel="nofollow noopener noreferrer">https://api.bitbucket.org/2.0/repositories/my-workspace/myrepository/src/feature%2Ftest/README.md</a>'
Response: {"data":{"shas":["feature"]},"type":"error","error":{"message":"Commit not found","data":{"shas":["feature"]}}}
Is there any workaround for this? Because I've been searching for similar issues and so far haven't come up with anything.