Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
71b6a4ba
Commit
71b6a4ba
authored
Apr 20, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return empty string on UTF8 conversion with U_STRING_NOT_TERMINATED_WARNING error
parent
b99853f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
changelogs/unreleased/fix-encoding-issue.yml
changelogs/unreleased/fix-encoding-issue.yml
+4
-0
lib/gitlab/git/encoding_helper.rb
lib/gitlab/git/encoding_helper.rb
+7
-1
spec/lib/gitlab/git/encoding_helper_spec.rb
spec/lib/gitlab/git/encoding_helper_spec.rb
+4
-0
No files found.
changelogs/unreleased/fix-encoding-issue.yml
0 → 100644
View file @
71b6a4ba
---
title
:
Fix encoding issue exporting a project
merge_request
:
author
:
lib/gitlab/git/encoding_helper.rb
View file @
71b6a4ba
...
...
@@ -40,7 +40,13 @@ module Gitlab
def
encode_utf8
(
message
)
detect
=
CharlockHolmes
::
EncodingDetector
.
detect
(
message
)
if
detect
begin
CharlockHolmes
::
Converter
.
convert
(
message
,
detect
[
:encoding
],
'UTF-8'
)
rescue
ArgumentError
=>
e
Rails
.
logger
.
warn
(
"Ignoring error converting
#{
detect
[
:encoding
]
}
into UTF8:
#{
e
.
message
}
"
)
''
end
else
clean
(
message
)
end
...
...
spec/lib/gitlab/git/encoding_helper_spec.rb
View file @
71b6a4ba
...
...
@@ -56,6 +56,10 @@ describe Gitlab::Git::EncodingHelper do
expect
(
r
.
encoding
.
name
).
to
eq
(
'UTF-8'
)
end
end
it
'returns empty string on conversion errors'
do
expect
{
ext_class
.
encode_utf8
(
''
)
}.
not_to
raise_error
(
ArgumentError
)
end
end
describe
'#clean'
do
...
...
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