Very old issues attachments return a 404 error
Summary
I have very old issues with old attachments that exist on disk, but return a 404 error. These issues have an identifier (a SHA1?) of 10 digits, instead of the 32 digits of attachments that work.
The change of length of the identifier seems to have happened between March 18, 2015 and March 24, 2015 according to the timestamps. I know it's very old, but we only saw this issue recently and we thought it was only affecting old bugs because of lost files, but the files exist.
Steps to reproduce
Probably install GitLab from March 18, 2015, add attachment and upgrade to GitLab from March 24, 2015, but I cannot be sure.
What is the current bug behavior?
An attachment https://git.example.com/group/project/uploads/1e320c3f20/IMG_0059.PNG returns a 404 whereas /opt/gitlab/embedded/service/gitlab-rails/public/uploads/group/project/1e320c3f20/IMG_0059.PNG exists.
An attachment https://git.example.com/group/project/uploads/8e7909363c244ed436f59cae588a836d/img.png works.
What is the expected correct behavior?
https://git.example.com/group/project/uploads/1e320c3f20/img.PNG should return the image.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.3 Go Version: unknownGitLab information Version: 11.6.3 Revision: bc9391c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://xxxxxxxxxx.com HTTP Clone URL: https://xxxxxxxxxx.com/some-group/some-project.git SSH Clone URL: git@xxxxxxxxxx.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.4.3 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
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 >= 8.4.3 ? ... OK (8.4.3) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: 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 ... 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 ...
Git configured correctly? ... yes 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? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 23/2 ... yes 23/3 ... yes 23/4 ... yes 23/5 ... yes 23/6 ... yes 23/8 ... yes 23/10 ... yes 23/11 ... yes 23/12 ... yes 10/13 ... yes 21/14 ... yes 23/18 ... yes 23/20 ... yes 23/21 ... yes 23/23 ... yes 23/24 ... yes 23/26 ... yes 23/27 ... yes 29/28 ... yes 23/29 ... yes 23/31 ... yes 23/32 ... yes 23/34 ... yes 23/35 ... yes 23/36 ... yes 23/37 ... yes 23/38 ... yes 23/39 ... yes 23/40 ... yes 23/41 ... yes 23/42 ... yes 23/43 ... yes 23/44 ... yes 23/45 ... yes 3/47 ... yes 23/49 ... yes 3/50 ... yes 23/51 ... yes 23/52 ... yes 23/53 ... yes 23/54 ... yes 23/56 ... yes 23/57 ... yes 23/58 ... yes 23/59 ... yes 23/60 ... yes 23/61 ... yes 23/62 ... yes 23/63 ... yes 23/64 ... yes 23/65 ... yes 23/66 ... yes 23/67 ... yes 23/68 ... yes 23/69 ... yes 23/70 ... yes 23/71 ... yes 23/72 ... yes 23/73 ... yes 23/74 ... yes 1/75 ... yes 23/76 ... yes 23/77 ... yes 23/78 ... yes 23/79 ... yes 23/80 ... yes 23/81 ... yes 23/82 ... yes 15/84 ... yes 24/85 ... yes 23/86 ... yes 23/87 ... yes 23/88 ... yes 23/89 ... yes 23/90 ... yes 23/91 ... yes 23/92 ... yes 23/93 ... yes 23/95 ... yes 23/96 ... yes 23/97 ... yes 23/99 ... yes 23/100 ... yes 23/101 ... yes 23/102 ... yes 23/103 ... yes 23/104 ... yes 23/105 ... yes 23/106 ... yes 23/107 ... yes 23/108 ... yes 23/109 ... yes 23/110 ... yes 23/111 ... yes 23/112 ... yes 36/113 ... yes 23/114 ... yes 23/115 ... yes 23/116 ... yes 23/117 ... yes 23/118 ... yes 23/119 ... yes 23/120 ... yes 23/121 ... yes 23/122 ... yes 23/123 ... yes 23/124 ... yes 23/125 ... yes 23/127 ... yes 5/128 ... yes 23/129 ... yes 23/130 ... yes 23/131 ... yes 23/132 ... yes 23/133 ... yes 23/134 ... yes 23/135 ... yes 23/136 ... yes 23/137 ... yes 23/138 ... yes 23/139 ... yes 23/140 ... yes 23/141 ... yes 23/142 ... yes 23/143 ... yes 23/145 ... yes 23/146 ... yes 23/147 ... yes 23/148 ... yes 23/149 ... yes 23/150 ... yes 3/151 ... yes 23/152 ... yes 23/153 ... yes 23/154 ... yes 23/155 ... yes 23/156 ... yes 23/157 ... yes 23/158 ... yes 23/159 ... yes 23/160 ... yes 23/161 ... yes 23/162 ... yes 23/163 ... yes 23/164 ... yes 23/165 ... yes 23/166 ... yes 23/167 ... yes 23/168 ... yes 23/169 ... yes 23/170 ... yes 23/171 ... yes 23/172 ... yes 23/173 ... yes 23/174 ... yes 23/175 ... yes 23/176 ... yes 23/177 ... yes 23/180 ... yes 23/181 ... yes 23/182 ... yes 23/183 ... yes 23/184 ... yes 23/185 ... yes 23/186 ... yes 3/187 ... yes 23/188 ... yes 23/189 ... yes 23/190 ... yes 23/191 ... yes 1/192 ... yes 1/193 ... yes 23/194 ... yes 23/196 ... yes 23/197 ... yes 23/198 ... yes 23/199 ... yes 23/200 ... yes 23/201 ... yes 23/202 ... yes 23/203 ... yes 21/204 ... yes 23/205 ... yes 23/206 ... yes 23/207 ... yes 23/208 ... yes 23/209 ... yes 23/210 ... yes 23/211 ... yes 21/212 ... yes 23/213 ... yes 23/214 ... yes 23/215 ... yes 23/216 ... yes 23/217 ... yes 23/218 ... yes 23/219 ... yes 23/220 ... yes 23/221 ... yes 23/222 ... yes 23/223 ... yes 23/224 ... yes 23/225 ... yes 23/226 ... yes 23/227 ... yes 23/228 ... yes 23/229 ... yes 23/230 ... yes 23/231 ... yes 23/232 ... yes 23/233 ... yes 23/234 ... yes 23/235 ... yes 23/236 ... yes 23/237 ... yes 23/238 ... yes 23/239 ... yes 23/240 ... yes 23/241 ... yes 23/242 ... yes 23/243 ... yes 23/244 ... yes 23/245 ... yes 87/246 ... yes 87/247 ... yes 87/248 ... yes 23/249 ... yes 93/250 ... yes 93/251 ... yes 93/252 ... yes 87/253 ... yes 87/254 ... yes 23/255 ... yes 23/256 ... yes 23/258 ... yes 23/259 ... yes 23/260 ... yes 23/262 ... yes 23/263 ... yes 93/264 ... yes 23/265 ... yes 23/266 ... yes 23/267 ... yes 23/270 ... yes 93/271 ... yes 23/272 ... yes 23/273 ... yes 93/274 ... yes 93/275 ... yes 23/276 ... yes 93/277 ... yes 23/278 ... yes 23/279 ... yes 23/281 ... yes 23/282 ... yes 23/283 ... yes 1/284 ... yes 23/285 ... yes 23/286 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 62
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished