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
Léo-Paul Géneau
gitlab-ce
Commits
d704f0c4
Commit
d704f0c4
authored
Dec 06, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent dups when using StringIO for binary reads
parent
bf934a8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+6
-0
lib/gitlab/gitaly_client/wiki_service.rb
lib/gitlab/gitaly_client/wiki_service.rb
+4
-6
No files found.
lib/gitlab/gitaly_client.rb
View file @
d704f0c4
...
@@ -336,6 +336,12 @@ module Gitlab
...
@@ -336,6 +336,12 @@ module Gitlab
s
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
s
.
dup
.
force_encoding
(
Encoding
::
ASCII_8BIT
)
end
end
def
self
.
binary_stringio
(
s
)
io
=
StringIO
.
new
(
s
||
''
)
io
.
set_encoding
(
Encoding
::
ASCII_8BIT
)
io
end
def
self
.
encode_repeated
(
a
)
def
self
.
encode_repeated
(
a
)
Google
::
Protobuf
::
RepeatedField
.
new
(
:bytes
,
a
.
map
{
|
s
|
self
.
encode
(
s
)
}
)
Google
::
Protobuf
::
RepeatedField
.
new
(
:bytes
,
a
.
map
{
|
s
|
self
.
encode
(
s
)
}
)
end
end
...
...
lib/gitlab/gitaly_client/wiki_service.rb
View file @
d704f0c4
...
@@ -18,12 +18,11 @@ module Gitlab
...
@@ -18,12 +18,11 @@ module Gitlab
commit_details:
gitaly_commit_details
(
commit_details
)
commit_details:
gitaly_commit_details
(
commit_details
)
)
)
strio
=
StringIO
.
new
(
content
)
strio
=
GitalyClient
.
binary_stringio
(
content
)
enum
=
Enumerator
.
new
do
|
y
|
enum
=
Enumerator
.
new
do
|
y
|
until
strio
.
eof?
until
strio
.
eof?
chunk
=
strio
.
read
(
MAX_MSG_SIZE
)
request
.
content
=
strio
.
read
(
MAX_MSG_SIZE
)
request
.
content
=
GitalyClient
.
encode
(
chunk
)
y
.
yield
request
y
.
yield
request
...
@@ -46,12 +45,11 @@ module Gitlab
...
@@ -46,12 +45,11 @@ module Gitlab
commit_details:
gitaly_commit_details
(
commit_details
)
commit_details:
gitaly_commit_details
(
commit_details
)
)
)
strio
=
StringIO
.
new
(
content
)
strio
=
GitalyClient
.
binary_stringio
(
content
)
enum
=
Enumerator
.
new
do
|
y
|
enum
=
Enumerator
.
new
do
|
y
|
until
strio
.
eof?
until
strio
.
eof?
chunk
=
strio
.
read
(
MAX_MSG_SIZE
)
request
.
content
=
strio
.
read
(
MAX_MSG_SIZE
)
request
.
content
=
GitalyClient
.
encode
(
chunk
)
y
.
yield
request
y
.
yield
request
...
...
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