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
b7ebb447
Commit
b7ebb447
authored
Aug 21, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly encode string params for Gitaly's TreeEntries RPC
parent
646aae3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+2
-2
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+14
-0
No files found.
lib/gitlab/gitaly_client/commit_service.rb
View file @
b7ebb447
...
@@ -80,8 +80,8 @@ module Gitlab
...
@@ -80,8 +80,8 @@ module Gitlab
def
tree_entries
(
repository
,
revision
,
path
)
def
tree_entries
(
repository
,
revision
,
path
)
request
=
Gitaly
::
GetTreeEntriesRequest
.
new
(
request
=
Gitaly
::
GetTreeEntriesRequest
.
new
(
repository:
@gitaly_repo
,
repository:
@gitaly_repo
,
revision:
revision
,
revision:
GitalyClient
.
encode
(
revision
)
,
path:
path
.
presen
ce
||
'.'
path:
path
.
presen
t?
?
GitalyClient
.
encode
(
path
)
:
'.'
)
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:commit_service
,
:get_tree_entries
,
request
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:commit_service
,
:get_tree_entries
,
request
)
...
...
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
View file @
b7ebb447
...
@@ -111,6 +111,20 @@ describe Gitlab::GitalyClient::CommitService do
...
@@ -111,6 +111,20 @@ describe Gitlab::GitalyClient::CommitService do
client
.
tree_entries
(
repository
,
revision
,
path
)
client
.
tree_entries
(
repository
,
revision
,
path
)
end
end
context
'with UTF-8 params strings'
do
let
(
:revision
)
{
"branch
\u
011F"
}
let
(
:path
)
{
"foo/
\u
011F.txt"
}
it
'handles string encodings correctly'
do
expect_any_instance_of
(
Gitaly
::
CommitService
::
Stub
)
.
to
receive
(
:get_tree_entries
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
([])
client
.
tree_entries
(
repository
,
revision
,
path
)
end
end
end
end
describe
'#find_commit'
do
describe
'#find_commit'
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