Gitlab API returns 404 Avatar Not Found when download an in-git avatar
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Hello,
I'm reporting a bug with the download avatar API endpoint when the avatar is hosted inside Git repository (as logo.png file).
Summary
Gitlab API return 404 Avatar Not Found when using the download avatar API endpoint if the avatar is deployed using a logo file inside Git repository. As describe in documentation: add-a-logo-to-your-repository. But if the logo is uploaded using the project settings, the API works as expected: upload-an-avatar-in-project-settings
It should be a bug because according to the documentation page of projects (https://docs.gitlab.com/ee/api/projects.html#download-a-project-avatar), /projects/:id/avatar can be used without authentification for public repository: Download a project avatar. You can access this endpoint without authentication if the project is publicly accessible..
Depending on the type of URL in avatar_url, the download API endpoint will not always work:
Project 26454230:
-
avatar_url: https://gitlab.com/uploads/-/system/project/avatar/26454230/logo.png - HTTP GET on
projects/26454230/avataris working✔️
Project 64911039:
-
avatar_url: https://gitlab.com/arnicel/gitlab-cp/-/avatar - HTTP GET on
projects/64911039/avataris not working❌
Steps to reproduce
- Open an incognito browser
- Go to "https://gitlab.com/api/v4/projects/64911039/avatar"
- Page return an error:
{"message":"404 Avatar Not Found"}
The error is not normal because the avatar does exist! Now, we use the real avatar_url from projects API:
- Open an incognito browser
- Go to "https://gitlab.com/api/v4/projects/64911039"
- Copy the
avatar_urlvalue and go to the url - Avatar download in progress...
What is the current bug behavior?
Download Avatar API endpoint on Gitlab project with in-git logo return a 404 Avatar Not Found.
What is the expected correct behavior?
The project is public, so we should be able to download the avatar without error. Like downloading the logo using the public avatar_url.
Output of checks
This bug happens on GitLab.com