Can not download files uploaded via older GitLab versions
Summary
When I try to download a file that was uploaded on the same installation but in one of the previous GitLab releases I see a 404.
Steps to reproduce
- Start with an old GitLab version. I can not tell which one to use but it seems the naming scheme of upload directory changed somewhen in 2016.
- Upload a file to an issue or the wiki
- Upgrade to the latest version and try to download the uploaded file
What is the current bug behavior?
I receive a 404 error.
What is the expected correct behavior?
The file should download properly.
Relevant logs and/or screenshots
The URL to the file is correct. It follows the same format as URLs for recent uploads. I also verified, that the hashed directory exists in the uploads/myname/myproject
directory exists.
I've checked the content of uploads/myname/myproject
. There are 2 types of directory names there: Older names use a hash of 40 characters. Newer uploads now only have 32 characters:
drwxr-xr-x 2 root root 4096 Mar 12 2016 9c882d5c6a1aa240b2672dce0ffb03360abcaca5
drwxr-xr-x 2 mike mike 4096 Jan 9 10:58 9cc9b8f74fa09869c64b4bc7e0ef163a
It's the 40 character long names that have the problems.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: root Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.5.2.2 Bundler Version:1.16.1 Rake Version: 12.3.0 Redis Version: 3.0.6 Git Version: 2.16.2 Sidekiq Version:5.0.5 Go Version: unknownGitLab information Version: 10.6.3 Revision: 753d851 Directory: /home/git/gitlab DB Adapter: mysql2 URL: https://git.secret.de HTTP Clone URL: https://git.secret.de/some-group/some-project.git SSH Clone URL: ssh://git@git.secret.de:****/some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 6.0.4 Repository storage paths:
- default: /home/git/data/repositories Hooks: /home/git/gitlab-shell/hooks Git: /usr/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Warning You are running as user root, we hope you know what you are doing. Things may work/fail for the wrong reasons. For correct results you should run this as user git.
Checking GitLab Shell ...
GitLab Shell version >= 6.0.4 ? ... OK (6.0.4) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 36/5 ... ok 1/43 ... ok 18/49 ... ok 1/87 ... ok 18/98 ... ok 1/99 ... ok 1/100 ... ok 1/101 ... ok 1/102 ... repository is empty 18/104 ... ok 18/105 ... repository is empty 1/106 ... ok 68/107 ... ok 68/108 ... ok Running /home/git/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /home/git/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... no Try fixing it: sudo -u git -H RAILS_ENV=production bin/background_jobs start For more information see: doc/install/installation.md in section "Install Init Script" see log/sidekiq.log for possible errors Please fix the error above and rerun the checks.
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... no Trying to fix error automatically. ...Failed Try fixing it: sudo -u git -H "/usr/bin/git" config --global core.autocrlf "input" For more information see: doc/install/installation.md in section "GitLab" Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... 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? ... no Try fixing it: sudo chown -R git /home/git/data/uploads sudo find /home/git/data/uploads -type f -exec chmod 0644 {} ; sudo find /home/git/data/uploads -type d -not -path /home/git/data/uploads -exec chmod 0700 {} ; For more information see: doc/install/installation.md in section "GitLab" Please fix the error above and rerun the checks. Init script exists? ... yes Init script up-to-date? ... yes Projects have namespace: ... 36/5 ... yes 1/43 ... yes 18/49 ... yes 1/87 ... yes 18/98 ... yes 1/99 ... yes 1/100 ... yes 1/101 ... yes 1/102 ... yes 18/104 ... yes 18/105 ... yes 1/106 ... yes 68/107 ... yes 68/108 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.3.6) Git version >= 2.9.5 ? ... yes (2.16.2) Git user has default SSH configuration? ... yes Active users: ... 32
Checking GitLab ... Finished