422 error ActionController::InvalidAuthenticityToken when creating new folders via UI in a folder called "uploads"
Summary
In a project, creating a new folder via the web UI inside a folder called "uploads"
Fails with "422 The change you requested was rejected."
Steps to reproduce
Create a new folder in the docs/uploads test project.
Example Project
https://gitlab.com/tormedo/test_upload_bug
Relevant logs and/or screenshots
Logs on our local instance:
==> /var/log/gitlab/gitlab-rails/production.log <==
Started POST "/example/wiki/-/create_dir/master/docs/uploads/authorize" for xxx.xxx.xxx.xxx at 2020-07-21 11:43:54 +0200
Processing by Projects::TreeController#create_dir as HTML
Parameters: {"namespace_id"=>"example", "project_id"=>"wiki", "id"=>"master/docs/uploads/authorize"}
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 4ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 1556)
==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"POST","path":"/example/wiki/-/create_dir/master/docs/uploads/authorize","format":"html","controller":"Projects::TreeController","action":"create_dir","status":422,"time":"2020-07-21T09:43:54.878Z","params":[{"key":"namespace_id","value":"example"},{"key":"project_id","value":"wiki"},{"key":"id","value":"master/docs/uploads/authorize"}],"remote_ip":"xxx.xxx.xxx.xxx","user_id":1,"username":"JhonDoe","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0","redis_calls":1,"redis_duration_s":0.000151,"redis_read_bytes":385,"redis_write_bytes":589,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.000151,"redis_shared_state_read_bytes":385,"redis_shared_state_write_bytes":589,"correlation_id":"8480e9a1-408e-4287-b555-xxxxxxxxxxx","cpu_s":0.02,"exception.class":"ActionController::InvalidAuthenticityToken","exception.message":"ActionController::InvalidAuthenticityToken","exception.backtrace":[],"db_duration_s":0.0,"view_duration_s":0.0,"duration_s":0.00451}
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
This bug happens on GitLab.com
Results of GitLab application Check
This bug happens on GitLab.com
Edited by tormedo
