mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
FIX: Use a tmp file in UploadRecovery
for local store.
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user