Get 404 when trying to download 'latest artifact' with link

Im trying to download the latest artifact for a build, but dont seem to be able to create the correct url.

From the doc. the url should be like this:
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
example from doc:

https://gitlab.com/gitlab-org/gitlab/-/jobs/artifacts/master/download?job=coverage

the only thing i can see differs is that i have project with a format that is:

foo/qaz/baz

When i copy the url from the GitLab portal that works, but its tied to the job-id, so when i switch out the id with branch name it stops working.

This is the url from the portal downloading artifact from a job with job-id:
https://gitlab.com/orgname/foo/qaz/baz/-/jobs/123456/artifacts/download
This works

So the url i thought ended up with that isnt working is:
https://gitlab.com/orgname/foo/qaz/baz/-/jobs/artifacts/test/download?job=build
This gives a 404 error