BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
6b53add3
Commit
6b53add3
authored
Jun 06, 2017
by
James Lopez
Committed by
Rémy Coutable
Jun 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix binary encoding error on MR diffs
parent
b9fcc48a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
fix-encoding-binary-issue.yml
changelogs/unreleased/fix-encoding-binary-issue.yml
+4
-0
encoding_helper.rb
lib/gitlab/encoding_helper.rb
+1
-1
merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+11
-0
No files found.
changelogs/unreleased/fix-encoding-binary-issue.yml
0 → 100644
View file @
6b53add3
---
title
:
Fix binary encoding error on MR diffs
merge_request
:
11929
author
:
lib/gitlab/encoding_helper.rb
View file @
6b53add3
...
...
@@ -38,7 +38,7 @@ module Gitlab
def
encode_utf8
(
message
)
detect
=
CharlockHolmes
::
EncodingDetector
.
detect
(
message
)
if
detect
if
detect
&&
detect
[
:encoding
]
begin
CharlockHolmes
::
Converter
.
convert
(
message
,
detect
[
:encoding
],
'UTF-8'
)
rescue
ArgumentError
=>
e
...
...
spec/models/merge_request_diff_spec.rb
View file @
6b53add3
...
...
@@ -139,4 +139,15 @@ describe MergeRequestDiff, models: true do
expect
(
subject
.
commits_count
).
to
eq
2
end
end
describe
'#utf8_st_diffs'
do
it
'does not raise error when a hash value is in binary'
do
subject
.
st_diffs
=
[
{
diff:
"
\0
"
},
{
diff:
"
\x05\x00\x68\x65\x6c\x6c\x6f
"
}
]
expect
{
subject
.
utf8_st_diffs
}.
not_to
raise_error
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment