Commit 817b00a4 authored by Stan Hu's avatar Stan Hu

Handle binary data properly in Geo transfer download

parent dc02c5da
...@@ -60,7 +60,7 @@ module Gitlab ...@@ -60,7 +60,7 @@ module Gitlab
file_size = -1 file_size = -1
begin begin
File.open(filename, "w") do |file| File.open(filename, "wb") do |file|
response = HTTParty.get(url, headers: req_header, stream_body: true) do |fragment| response = HTTParty.get(url, headers: req_header, stream_body: true) do |fragment|
file.write(fragment) file.write(fragment)
end end
......
...@@ -9,7 +9,7 @@ describe Gitlab::Geo::Transfer do ...@@ -9,7 +9,7 @@ describe Gitlab::Geo::Transfer do
let(:size) { File.stat(lfs_object.file.path).size } let(:size) { File.stat(lfs_object.file.path).size }
before do before do
allow(File).to receive(:open).with(lfs_object.file.path, "w").and_yield(content) allow(File).to receive(:open).with(lfs_object.file.path, "wb").and_yield(content)
end end
subject do subject 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