CommitController Crashes with 500
Summary
There is an error 500 if you want to compare some commits. You can reproduce this in gitlab.com (https://gitlab.com/sweting/sweting_test/commit/5f829e9b4f5f427bc1ed764df99b710ad17d4e89)
Steps to reproduce
Checkin some files like in my testproject https://gitlab.com/sweting/sweting_test
Example Project
https://gitlab.com/sweting/sweting_test
What is the current bug behavior?
I have added some filesto the repo an if I want so see the details of a commit or compare something then i get the error 500. See the two links below for example.
- Compare: https://gitlab.com/sweting/sweting_test/compare/e37cfa03273fabee7cc3389916a698eb2388a9fb...master
- Commit: https://gitlab.com/sweting/sweting_test/commit/5f829e9b4f5f427bc1ed764df99b710ad17d4e89
What is the expected correct behavior?
I want to see view with the diff for the commkit or the diff between some commits.
Relevant logs and/or screenshots
There is no screen. The Log on my server is something like this
Started GET "/<...>/compare/4.15MsSql...4.18MsSql?view=parallel" for 10.147.37.112 at 2018-06-28 10:32:23 +0200
Processing by Projects::CompareController#show as HTML
Parameters: {"view"=>"parallel", "namespace_id"=>"CGX", "project_id"=>"CGMsSql_DLL", "from"=>"4.15MsSql", "to"=>"4.18MsSql"}
Read fragment views</...>/de67ec79a086728faebafe7fe54bdc9ea1836300/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Write fragment views</...>/de67ec79a086728faebafe7fe54bdc9ea1836300/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/5c54ce66229cf31a1552fe256217ae06fc03b722/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Write fragment views</...>/5c54ce66229cf31a1552fe256217ae06fc03b722/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/dc7d8d92bfd55ebdd37f0eef174c43b735bb6a9b/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Write fragment views</...>/dc7d8d92bfd55ebdd37f0eef174c43b735bb6a9b/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/ab7b09c76e80b40e2572064f988c8e35893f6a0d/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Write fragment views</...>/ab7b09c76e80b40e2572064f988c8e35893f6a0d/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/e5b8cbdff086202db2ad0998d64dc938439afb03/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Write fragment views</...>/e5b8cbdff086202db2ad0998d64dc938439afb03/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Read fragment views</...>/d9ac4cfadda906a1cdad0d8c69a51ea7bd0d0a15/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Write fragment views</...>/d9ac4cfadda906a1cdad0d8c69a51ea7bd0d0a15/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/d368ce1f3cc514bf6e185547fe631010d2106ef9/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Write fragment views</...>/d368ce1f3cc514bf6e185547fe631010d2106ef9/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.6ms)
Read fragment views</...>/f8244d2cd2ebe155c1491782aca3dc6d01ee4951/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.4ms)
Write fragment views</...>/f8244d2cd2ebe155c1491782aca3dc6d01ee4951/application_settings/5-20180220160020372058000/false/false/en/c2f8d950fa9db2e35a02f0850842ab42 (0.5ms)
Completed 500 Internal Server Error in 444ms (ActiveRecord: 37.9ms)
ActionView::Template::Error (string contains null byte):
1: - environment = local_assigns.fetch(:environment, nil)
2: - file_hash = hexdigest(diff_file.file_path)
3: - image_diff = diff_file.rich_viewer && diff_file.rich_viewer.partial_name == 'image'
4: - image_replaced = diff_file.old_content_sha && diff_file.old_content_sha != diff_file.content_sha
5:
6: .diff-file.file-holder{ id: file_hash, data: diff_file_html_data(project, diff_file.file_path, diff_file.content_sha) }
lib/gitlab/git/attributes_parser.rb:102:in `join'
lib/gitlab/git/attributes_parser.rb:102:in `block in parse_data'
lib/gitlab/git/attributes_parser.rb:84:in `block in each_line'
lib/gitlab/git/attributes_parser.rb:81:in `each_line'
lib/gitlab/git/attributes_parser.rb:81:in `each_line'
lib/gitlab/git/attributes_parser.rb:95:in `parse_data'
lib/gitlab/git/attributes_parser.rb:27:in `patterns'
lib/gitlab/git/attributes_parser.rb:18:in `attributes'
lib/gitlab/git/repository.rb:1068:in `attributes'
app/models/repository.rb:463:in `method_missing'
lib/gitlab/diff/file.rb:178:in `diffable?'
lib/gitlab/diff/file.rb:313:in `viewer_class_from'
lib/gitlab/diff/file.rb:309:in `rich_viewer_class'
lib/gitlab/diff/file.rb:235:in `rich_viewer'
app/views/projects/diffs/_file.html.haml:3:in `_app_views_projects_diffs__file_html_haml__1543396746391668367_69994098042640'
app/views/projects/diffs/_diffs.html.haml:28:in `_app_views_projects_diffs__diffs_html_haml__3654706349284955956_69994114866840'
app/views/projects/compare/show.html.haml:11:in `_app_views_projects_compare_show_html_haml___635119821357244473_69994121505100'
app/controllers/projects/compare_controller.rb:24:in `show'
lib/gitlab/i18n.rb:50:in `with_locale'
lib/gitlab/i18n.rb:56:in `with_user_locale'
app/controllers/application_controller.rb:362:in `set_locale'
lib/gitlab/middleware/multipart.rb:95:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:17:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/read_only/controller.rb:28:in `call'
lib/gitlab/middleware/read_only.rb:16:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Output of checks
This bug happens on GitLab.com
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
Edited by 🤖 GitLab Bot 🤖