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

  1. Create a project
  2. Make a commit with some change(echo 'hello' > hello.txt && git add hello.txt && git commit -m 'hello')
  3. Add a tag and push it (git tag 'hello' && git push origin hello)
  4. Make another change (echo 'hello again ' >> hello.txt && git add hello.txt && git commit -m 'hello again')
  5. Make a branch with the same name and push (git checkout -b hello && git push origin refs/heads/hello)
  6. 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