FIX: Use a tmp file in UploadRecovery for local store.

This commit is contained in:
Guo Xiang Tan
2018-09-19 15:46:23 +08:00
parent e0e6dae6a7
commit 293cf600f0

View File

@ -90,10 +90,12 @@ class UploadRecovery
@paths.each do |path| @paths.each do |path|
if path =~ /#{sha1}/ if path =~ /#{sha1}/
begin begin
file = File.open(path, "r") tmp = Tempfile.new
create_upload(file, File.basename(path), post) tmp.write(File.read(path))
tmp.rewind
create_upload(tmp, File.basename(path), post)
ensure ensure
file&.close tmp&.close
end end
end end
end end