Storing PDF data in README.md breaks Gitlab
Summary
One of our students put a PDF report in READMD.md and Gitlab became unusable for her. Here's an extract from the log...
==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
output error : unknown encoding ASCII-8BIT
==> /var/log/gitlab/gitlab-rails/production.log <==
Completed 500 Internal Server Error in 334ms (ActiveRecord: 23.7ms)
ActionView::Template::Error (invalid byte sequence in UTF-8):
5: %strong
6: = readme.name
7: .file-content.wiki
8: = render_readme(readme)
lib/banzai/filter/emoji_filter.rb:18:in `match'
lib/banzai/filter/emoji_filter.rb:18:in `match'
lib/banzai/filter/emoji_filter.rb:18:in `block in call'
lib/banzai/filter/emoji_filter.rb:14:in `call'
lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
lib/banzai/renderer.rb:117:in `render_result'
lib/banzai/renderer.rb:146:in `block in cacheless_render'
lib/gitlab/metrics.rb:88:in `measure'
lib/banzai/renderer.rb:145:in `cacheless_render'
lib/banzai/renderer.rb:30:in `render'
lib/banzai.rb:3:in `render'
app/helpers/gitlab_markdown_helper.rb:51:in `markdown'
app/helpers/application_helper.rb:204:in `render_markup'
app/helpers/tree_helper.rb:16:in `render_readme'
app/views/projects/tree/_readme.html.haml:8:in `_app_views_projects_tree__readme_html_haml___2496834008807627574_70134792169740'
app/views/projects/tree/_tree_content.html.haml:31:in `_app_views_projects_tree__tree_content_html_haml__2201343548870009176_70134815445120'
app/views/projects/_files.html.haml:5:in `_app_views_projects__files_html_haml___1075111661058725741_70134751138760'
app/views/projects/show.html.haml:94:in `_app_views_projects_show_html_haml___257231136734449135_70134824573740'
lib/gitlab/request_profiler/middleware.rb:15:in `call'
lib/gitlab/middleware/go.rb:16:in `call'
Steps to reproduce
It probably depends on the PDF document you use, I can provide one if required.
Expected behavior
Any graceful failure would do.
Actual behavior
500 server error...
Relevant logs and/or screenshots
Oops. They're above.
Output of checks
?
Results of GitLab application Check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)
(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)
(we will only investigate if the tests are passing)
Results of GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)
(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
