Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark
Here was the problem: 1. When determining whether a given blob is viewable text, gitlab_git reads the first 1024 bytes and checks with Linguist whether it is a text or binary file. 2. If the blob is text, GitLab will attempt to display it. 3. However, if the text has binary characters after the first 1024 bytes, then GitLab will attempt to load the entire contents, but the encoding will be ASCII-8BIT since there are binary characters. 4. The Error 500 results when GitLab attempts to display a mix UTF-8 and ASCII-8BIT. To fix this, we load as much data as we are willing to display so that the detection will work properly. Requires an update to gitlab_git: gitlab-org/gitlab_git!86 Closes #13826
显示
- CHANGELOG 1 个添加, 0 个删除CHANGELOG
- Gemfile.lock 2 个添加, 2 个删除Gemfile.lock
- app/helpers/blob_helper.rb 1 个添加, 1 个删除app/helpers/blob_helper.rb
- app/models/blob.rb 1 个添加, 1 个删除app/models/blob.rb
- app/models/repository.rb 1 个添加, 1 个删除app/models/repository.rb
- app/views/projects/diffs/_diffs.html.haml 1 个添加, 0 个删除app/views/projects/diffs/_diffs.html.haml
- app/views/projects/diffs/_file.html.haml 2 个添加, 0 个删除app/views/projects/diffs/_file.html.haml
- spec/controllers/blob_controller_spec.rb 5 个添加, 0 个删除spec/controllers/blob_controller_spec.rb
- spec/controllers/projects/commit_controller_spec.rb 12 个添加, 0 个删除spec/controllers/projects/commit_controller_spec.rb
- spec/support/test_env.rb 1 个添加, 0 个删除spec/support/test_env.rb
想要评论请 注册 或 登录