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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0587cf1e
Commit
0587cf1e
authored
Apr 01, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
f8f5724b
dba3fc46
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
11 deletions
+22
-11
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+1
-2
lib/gitlab/encoding_helper.rb
lib/gitlab/encoding_helper.rb
+5
-2
lib/gitlab/gitaly_client/conflicts_service.rb
lib/gitlab/gitaly_client/conflicts_service.rb
+1
-1
lib/gitlab/gitaly_client/operation_service.rb
lib/gitlab/gitaly_client/operation_service.rb
+2
-2
lib/gitlab/gitaly_client/wiki_service.rb
lib/gitlab/gitaly_client/wiki_service.rb
+2
-2
spec/lib/gitlab/encoding_helper_spec.rb
spec/lib/gitlab/encoding_helper_spec.rb
+11
-2
No files found.
app/controllers/projects/blob_controller.rb
View file @
0587cf1e
...
...
@@ -172,8 +172,7 @@ class Projects::BlobController < Projects::ApplicationController
end
if
params
[
:file
].
present?
params
[
:content
]
=
Base64
.
encode64
(
params
[
:file
].
read
)
params
[
:encoding
]
=
'base64'
params
[
:content
]
=
params
[
:file
]
end
@commit_params
=
{
...
...
lib/gitlab/encoding_helper.rb
View file @
0587cf1e
...
...
@@ -76,8 +76,11 @@ module Gitlab
str
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
end
def
binary_stringio
(
str
)
StringIO
.
new
(
str
.
freeze
||
''
).
tap
{
|
io
|
io
.
set_encoding
(
Encoding
::
ASCII_8BIT
)
}
def
binary_io
(
str_or_io
)
io
=
str_or_io
.
to_io
.
dup
if
str_or_io
.
respond_to?
(
:to_io
)
io
||=
StringIO
.
new
(
str_or_io
.
to_s
.
freeze
)
io
.
tap
{
|
io
|
io
.
set_encoding
(
Encoding
::
ASCII_8BIT
)
}
end
private
...
...
lib/gitlab/gitaly_client/conflicts_service.rb
View file @
0587cf1e
...
...
@@ -37,7 +37,7 @@ module Gitlab
end
def
resolve_conflicts
(
target_repository
,
resolution
,
source_branch
,
target_branch
)
reader
=
binary_
string
io
(
resolution
.
files
.
to_json
)
reader
=
binary_io
(
resolution
.
files
.
to_json
)
req_enum
=
Enumerator
.
new
do
|
y
|
header
=
resolve_conflicts_request_header
(
target_repository
,
resolution
,
source_branch
,
target_branch
)
...
...
lib/gitlab/gitaly_client/operation_service.rb
View file @
0587cf1e
...
...
@@ -294,7 +294,7 @@ module Gitlab
action:
Gitaly
::
UserCommitFilesAction
.
new
(
header:
action_header
)
)
reader
=
binary_
string
io
(
action
[
:content
])
reader
=
binary_io
(
action
[
:content
])
until
reader
.
eof?
chunk
=
reader
.
read
(
MAX_MSG_SIZE
)
...
...
@@ -327,7 +327,7 @@ module Gitlab
user:
Gitlab
::
Git
::
User
.
from_gitlab
(
user
).
to_gitaly
,
target_branch:
encode_binary
(
branch_name
)
)
reader
=
binary_
string
io
(
patches
)
reader
=
binary_io
(
patches
)
chunks
=
Enumerator
.
new
do
|
chunk
|
chunk
.
yield
Gitaly
::
UserApplyPatchRequest
.
new
(
header:
header
)
...
...
lib/gitlab/gitaly_client/wiki_service.rb
View file @
0587cf1e
...
...
@@ -22,7 +22,7 @@ module Gitlab
commit_details:
gitaly_commit_details
(
commit_details
)
)
strio
=
binary_
string
io
(
content
)
strio
=
binary_io
(
content
)
enum
=
Enumerator
.
new
do
|
y
|
until
strio
.
eof?
...
...
@@ -49,7 +49,7 @@ module Gitlab
commit_details:
gitaly_commit_details
(
commit_details
)
)
strio
=
binary_
string
io
(
content
)
strio
=
binary_io
(
content
)
enum
=
Enumerator
.
new
do
|
y
|
until
strio
.
eof?
...
...
spec/lib/gitlab/encoding_helper_spec.rb
View file @
0587cf1e
...
...
@@ -189,14 +189,23 @@ describe Gitlab::EncodingHelper do
end
end
describe
'#binary_
string
io'
do
describe
'#binary_io'
do
it
'does not mutate the original string encoding'
do
test
=
'my-test'
io_stream
=
ext_class
.
binary_
string
io
(
test
)
io_stream
=
ext_class
.
binary_io
(
test
)
expect
(
io_stream
.
external_encoding
.
name
).
to
eq
(
'ASCII-8BIT'
)
expect
(
test
.
encoding
.
name
).
to
eq
(
'UTF-8'
)
end
it
'returns a copy of the IO with the correct encoding'
do
test
=
fixture_file_upload
(
'spec/fixtures/doc_sample.txt'
).
to_io
io_stream
=
ext_class
.
binary_io
(
test
)
expect
(
io_stream
.
external_encoding
.
name
).
to
eq
(
'ASCII-8BIT'
)
expect
(
test
).
not_to
eq
(
io_stream
)
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