Commit 539ed0a6 authored by Robert Speicher's avatar Robert Speicher

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

Correctly encode string params for Gitaly's TreeEntries RPC

Closes #36720

See merge request !13724
parents ce578272 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.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)
......
...@@ -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\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
describe '#find_commit' do describe '#find_commit' do
......
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