Raw controller endpoint defaults to tag when ref is ambiguous
Summary
When a repository contains a file that exists at a tag and on a branch, the raw controller endpoint responds with the version of the file at the tag by default.
For example: https://gitlab.com/JonathonReinhart/ambiguous-ref-test/-/raw/v1.0/foo.txt
Steps to reproduce
- Create a project
- Make a commit with some change(echo 'hello' > hello.txt && git add hello.txt && git commit -m 'hello')
- Add a tag and push it (git tag 'hello' && git push origin hello)
- Make another change (echo 'hello again ' >> hello.txt && git add hello.txt && git commit -m 'hello again')
- Make a branch with the same name and push (git checkout -b hello && git push origin refs/heads/hello)
- Make a request to the raw and (e.g http://127.0.0.1:3000/root/projectname/-/raw/hello/hello.txt) and see
Example Project
https://gitlab.com/JonathonReinhart/ambiguous-ref-test/
What is the current bug behavior?
There is no way retrieve the raw version of the file as it exists in the branch
What is the expected correct behavior?
There should be a way to request the version of the file as it exists in the as well as the version of the file for the tag.
Output of checks
This bug happens on GitLab.com
Possible fixes
Consider updating links to the raw endpoint to include a ref_type parameter when applicable, so that the fully qualified ref can be used for the endpoint instead