Object-storage files downloaded via API from browser do not have correct file name and extension

Summary

When using object storage to store your artifacts, packages, etc, such files downloaded via API from browser do not have correct file name and extension.

Steps to reproduce

  • Install GitLab 16.11.x or GitLab 17.0 and enable object storage.
  • Create a test package file and upload it to the package registry: curl --header "PRIVATE-TOKEN: ***" --upload-file file1.tar.gz "https://gitlab.host/api/v4/projects/1/packages/generic/package1/0.0.1/file1.tar.gz"
  • Try to download it using API via browser: https://gitlab.host/api/v4/projects/1/packages/generic/package1/0.0.1/file1.tar.gz

What is the current bug behavior?

The file is downloaded successfully, but the file name corresponds to the name with which it is stored at the object storage & there is no file extension (like 102dec1159d28c7e2d7dae5ff2113458d78820b47c04f5dede6a774d243e).

What is the expected correct behavior?

File name & extension should be correct when downloading the file using API via browser.

Relevant logs and/or screenshots

api_via_browser

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:		Debian 12
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.1.5p253
Gem Version:	3.5.9
Bundler Version:2.5.9
Rake Version:	13.0.6
Redis Version:	7.0.15
Sidekiq Version:7.1.6
Go Version:	unknown

GitLab information
Version:	17.0.0-ee
Revision:	8c75d0bf4a4
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	14.11
URL:		https://gl.atanayno-4bfbd21c.gcp.gitlabsandbox.net
HTTP Clone URL:	https://gl.atanayno-4bfbd21c.gcp.gitlabsandbox.net/some-group/some-project.git
SSH Clone URL:	git@gl.atanayno-4bfbd21c.gcp.gitlabsandbox.net:some-group/some-project.git
Elasticsearch:	no
Geo:		yes
Geo node:	Undefined
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	14.35.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	17.0.0
- default Git Version: 	2.44.0.gl2

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.35.0 ? ... OK (14.35.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes Tables are truncated? ... skipped All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... ... Redis version >= 6.2.14? ... yes Ruby version >= 3.0.6 ? ... yes (3.1.5) Git user has default SSH configuration? ... no Try fixing it: mkdir ~/gitlab-check-backup-1715944910 sudo mv /var/opt/gitlab/.ssh/authorized_keys.bak ~/gitlab-check-backup-1715944910 For more information see: doc/user/ssh.md#overriding-ssh-settings-on-the-gitlab-server Please fix the error above and rerun the checks. Active users: ... 47 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled) All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished ...

Additional information

  • It was possible to download files using this way in GitLab 16.10. It affects not only packages but presumably any files stored in the object storage (tested with packages & artifacts).
  • Downloading via API & CLI works fine.
  • It is also possible to download files via Deploy > Package registry. /label typebug
Edited by 🤖 GitLab Bot 🤖