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

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

Correctly encode string params for Gitaly's TreeEntries RPC

Closes #36720

See merge request !13724
......@@ -80,8 +80,8 @@ def tree_entry(ref, path, limit = nil)
def tree_entries(repository, revision, path)
request = Gitaly::GetTreeEntriesRequest.new(
repository: @gitaly_repo,
revision: revision,
path: path.presence || '.'
revision: GitalyClient.encode(revision),
path: path.present? ? GitalyClient.encode(path) : '.'
)
response = GitalyClient.call(@repository.storage, :commit_service, :get_tree_entries, request)
......
......@@ -111,6 +111,20 @@
client.tree_entries(repository, revision, path)
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
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