diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-25 19:08:38 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-25 19:08:38 +0000 |
commit | 75ed0e27d95dcdb6dcc970f25a77e1bd0a63b78f (patch) | |
tree | 520855607987139f7b977d4fb9312e315b1f332f /spec/lib | |
parent | 2933f3f5975c0176262998cca38b0a3e7ca3c114 (diff) | |
parent | 44eb3197a9c30503a00384b3d688b64558b80397 (diff) | |
download | gitlab-ce-75ed0e27d95dcdb6dcc970f25a77e1bd0a63b78f.tar.gz |
Merge branch '21247-mergerequestscontroller-conflicts-may-fail-with-iso-8859-data' into 'master'
Handle non-UTF-8 conflicts gracefully
## What does this MR do?
If a conflict file isn't in a UTF-8-compatible encoding, we can't resolve it in the UI.
## What are the relevant issue numbers?
Closes #21247.
See merge request !5961
Diffstat (limited to 'spec/lib')
-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 |