Whitespace in wiki attachment file name causing 404
Summary
We are migrating from Trac to GitLab EE 11.8 self-managed. A wiki page was created with a link:
##### Orphaned attachments
##### These are the attachments files found but with no references
##### in the page contents.
##### During migration the following orphaned attachments have been found:
- [Project Plan Summer 2017.pdf](/uploads/2017InternDashboard/Project Plan Summer 2017.pdf)
and the file was created:
root@gitlab:/var/opt/gitlab/gitlab-rails/uploads/company/TestProject/2017InternDashboard# ls -l
total 492
-rw-r--r-- 1 git git 165118 Mar 8 20:29 Project Plan Summer 2017.pdf
When we try to click on that link, we get a 404 Page Not Found error. If I remove the whitespace from both the link and the file name, the link works fine.
So this link doesn't work even though the file exists with proper ownership and permissions: http://gitlab.company.org/company/TestProject/uploads/2017InternDashboard/Project%20Plan%20Summer%202017.pdf
What's interesting is that md file names that contain whitespace work just fine: http://gitlab.company.org/company/TestProject/wikis/Roadmap%202013
Steps to reproduce
Copy file with filename containing whitespace to uploads directory for the project.
Try to access that file via a web link.
Example Project
(If possible, please create an example project here on GitLab.com that exhibits the problematic behaviour, and link to it here in the bug report)
(If you are using an older version of GitLab, this will also determine whether the bug has been fixed in a more recent version)
What is the current bug behavior?
404
What is the expected correct behavior?
file downloads or is viewable in the browser
Relevant logs and/or screenshots
Started GET "/company/TestProject/uploads/2017InternDashboard/Project%20Plan%20Summer%202017.pdf" for 127.0.0.1 at 2019-03-14 10:25:32 -0400
Processing by Projects::UploadsController#show as HTML
Parameters: {"namespace_id"=>"company", "project_id"=>"TestProject", "secret"=>"[FILTERED]", "filename"=>"Project Plan Summer 2017.pdf"}
Completed 404 Not Found in 27ms (Views: 10.5ms | ActiveRecord: 2.6ms | Elasticsearch: 0.0ms)
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Proxy: no 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.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknown
GitLab information Version: 11.8.1-ee Revision: 39d0b2e Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.11 URL: http://gitlab.company.org HTTP Clone URL: http://gitlab.company.org/some-group/some-project.git SSH Clone URL: ssh://git@gitlab.company.org:2224/some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 8.4.4 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.4 ? ... OK (8.4.4) 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: ... Server: ldapmain not verifying SSL hostname of LDAPS server '(removed ldap url):636' LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) (removed user list)
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: ... 2/3 ... yes 3/4 ... yes 3/6 ... yes 2/9 ... 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: ... 19 Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)