Commit 809ac80a authored by Robert Speicher's avatar Robert Speicher Committed by Jarka Kadlecova

Merge branch 'gitaly-tree-entries-encoding' into 'master'

Correctly encode string params for Gitaly's TreeEntries RPC

Closes #36720

See merge request !13724
parent b7712260
...@@ -63,8 +63,8 @@ module Gitlab ...@@ -63,8 +63,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.presence || '.' path: path.present? ? 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)
......
...@@ -119,5 +119,19 @@ describe Gitlab::GitalyClient::CommitService do ...@@ -119,5 +119,19 @@ 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\u011F" }
let(:path) { "foo/\u011F.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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment