Editing a wiki page with `#` at the beginning of a Title results in the removal of all other wiki pages
Summary
Editing a wiki page with #
at the beginning of its Title leads to the removal of all other wiki pages in a project.
Steps to reproduce
- Create an empty project in GitLab.com, go to Wiki section and create several pages there
- Create a page with the title like
# Page003
, save it - Open the page
# Page003
, click Edit and Save Changes (you may make some changes or not, it does not matter). After that, all other Wiki pages will be removed!
Example Project
https://gitlab.com/atanayno/wiki-test/wikis/
What is the current bug behavior?
All other wiki pages in the project are removed when editing the page with #
in the title.
What is the expected correct behavior?
All other wiki pages in the project should not be affected.
Relevant logs and/or screenshots
production.log and production_json.log collected on a self-hosted instance while editing the page:
==> /var/log/gitlab/gitlab-rails/production.log <==
Started PUT "/root/fallball/wikis/%23-Page003" for 5.128.37.99 at 2018-06-08 07:39:40 +0000
Processing by Projects::WikisController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "wiki"=>{"last_commit_sha"=>"852d7cc72857053381f6b950a085b4e5994e240b", "title"=>"# Page003", "format"=>"markdown", "content"=>"page003", "message"=>"Update # Page003"}, "namespace_id"=>"root", "project_id"=>"fallball", "id"=>"#-Page003"}
Started POST "/api/v4/internal/allowed" for 127.0.0.1 at 2018-06-08 07:39:40 +0000
Started POST "/api/v4/internal/pre_receive" for 127.0.0.1 at 2018-06-08 07:39:40 +0000
Started POST "/api/v4/internal/post_receive" for 127.0.0.1 at 2018-06-08 07:39:40 +0000
Redirected to https://atanaynogitlab002.tk/root/fallball/wikis/%23-Page003
Completed 302 Found in 425ms (ActiveRecord: 11.1ms | Elasticsearch: 0.0ms)
==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"PUT","path":"/root/fallball/wikis/%23-Page003","format":"html","controller":"Projects::WikisController","action":"update","status":302,"duration":429.78,"view":0.0,"db":11.1,"location":"https://atanaynogitlab002.tk/root/fallball/wikis/%23-Page003","time":"2018-06-08T07:39:40.495Z","params":[{"key":"utf8","value":"✓"},{"key":"_method","value":"put"},{"key":"authenticity_token","value":"[FILTERED]"},{"key":"wiki","value":{"last_commit_sha":"852d7cc72857053381f6b950a085b4e5994e240b","title":"# Page003","format":"markdown","content":"page003","message":"Update # Page003"}},{"key":"namespace_id","value":"root"},{"key":"project_id","value":"fallball"},{"key":"id","value":"#-Page003"}],"remote_ip":"5.128.37.99","user_id":1,"username":"root","gitaly_calls":13}
==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/root/fallball/wikis/%23-Page003" for 5.128.37.99 at 2018-06-08 07:39:41 +0000
Processing by Projects::WikisController#show as HTML
Parameters: {"namespace_id"=>"root", "project_id"=>"fallball", "id"=>"#-Page003"}
Completed 200 OK in 130ms (Views: 98.4ms | ActiveRecord: 5.4ms | Elasticsearch: 0.0ms)
==> /var/log/gitlab/gitlab-rails/production_json.log <==
{"method":"GET","path":"/root/fallball/wikis/%23-Page003","format":"html","controller":"Projects::WikisController","action":"show","status":200,"duration":131.34,"view":98.38,"db":5.36,"time":"2018-06-08T07:39:41.325Z","params":[{"key":"namespace_id","value":"root"},{"key":"project_id","value":"fallball"},{"key":"id","value":"#-Page003"}],"remote_ip":"5.128.37.99","user_id":1,"username":"root","gitaly_calls":5}
Output of checks
This bug happens on GitLab.com, also reproduced on a self-hosted instance with GitLab 10.8.0-ee.