Fix encoding issue with Repository.ls_files
This commit is contained in:
parent
e54dd249aa
commit
d6066870cc
7 changed files with 8 additions and 1 deletions
|
@ -18,7 +18,7 @@ module Gitlab
|
|||
|
||||
response = GitalyClient.call(@repository.storage, :commit_service, :list_files, request)
|
||||
response.flat_map do |msg|
|
||||
msg.paths.map { |d| d.dup.force_encoding(Encoding::UTF_8) }
|
||||
msg.paths.map { |d| EncodingHelper.encode!(d.dup) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1163,6 +1163,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
|
|||
|
||||
describe "#ls_files" do
|
||||
let(:master_file_paths) { repository.ls_files("master") }
|
||||
let(:utf8_file_paths) { repository.ls_files("ls-files-utf8") }
|
||||
let(:not_existed_branch) { repository.ls_files("not_existed_branch") }
|
||||
|
||||
it "read every file paths of master branch" do
|
||||
|
@ -1184,6 +1185,10 @@ describe Gitlab::Git::Repository, seed_helper: true do
|
|||
it "returns empty array when not existed branch" do
|
||||
expect(not_existed_branch.length).to equal(0)
|
||||
end
|
||||
|
||||
it "returns valid utf-8 data" do
|
||||
expect(utf8_file_paths.map { |file| file.force_encoding('utf-8') }).to all(be_valid_encoding)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#copy_gitattributes" do
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
x¥ŽK
|
||||
Â0Eg<15>NIÒ|ADtè*^’
mZ qGîÄ<C3AE>Y×àð8—×ZK©ý®7"ÈFc’Ò%oH¢D²Ü9rZÛLÎs“MJ2Œ™=±ÑÒAå…CmeFg²·V<C2B7>¨xI9øH2†¯þXÜJ…ár»pÅ6‡Ï;NÔà8•zˆ?<3F>?>ß+–ù×z¡¹WÆ<57>BÞÎÙf·Ç}«þßb¡N@K\SYîì•iSC
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue