Merge branch 'gitaly-tree-entries-encoding' into 'master'
Correctly encode string params for Gitaly's TreeEntries RPC Closes #36720 See merge request !13724
This commit is contained in:
commit
539ed0a637
2 changed files with 16 additions and 2 deletions
|
@ -80,8 +80,8 @@ module Gitlab
|
|||
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 @@ describe Gitlab::GitalyClient::CommitService do
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue