diff options
author | Sean McGivern <sean@gitlab.com> | 2016-08-23 18:37:14 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-08-25 10:27:08 +0300 |
commit | 44eb3197a9c30503a00384b3d688b64558b80397 (patch) | |
tree | 852391adf4834d2ef8cc6a53e173e93c5b533c9b /spec/lib/gitlab/conflict | |
parent | b2bf01f4c271be66e93ed6f4b48a1da4d50e558d (diff) |
Handle non-UTF-8 conflicts gracefully
These can't be resolved in the UI because if they aren't in a UTF-8
compatible encoding, they can't be rendered as JSON. Even if they could,
we would be implicitly changing the file encoding anyway, which seems
like a bad idea.
Diffstat (limited to 'spec/lib/gitlab/conflict')
-rw-r--r-- | spec/lib/gitlab/conflict/parser_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/gitlab/conflict/parser_spec.rb b/spec/lib/gitlab/conflict/parser_spec.rb index 65a828accde..a1d2ca1e272 100644 --- a/spec/lib/gitlab/conflict/parser_spec.rb +++ b/spec/lib/gitlab/conflict/parser_spec.rb @@ -183,6 +183,11 @@ CONFLICT expect { parse_text('a' * 102401) }. to raise_error(Gitlab::Conflict::Parser::UnmergeableFile) end + + it 'raises UnsupportedEncoding when the file contains non-UTF-8 characters' do + expect { parse_text("a\xC4\xFC".force_encoding(Encoding::ASCII_8BIT)) }. + to raise_error(Gitlab::Conflict::Parser::UnsupportedEncoding) + end end end end |