mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +08:00
FIX: Use a tmp file in UploadRecovery
for local store.
This commit is contained in:
parent
e0e6dae6a7
commit
293cf600f0
|
@ -90,10 +90,12 @@ class UploadRecovery
|
|||
@paths.each do |path|
|
||||
if path =~ /#{sha1}/
|
||||
begin
|
||||
file = File.open(path, "r")
|
||||
create_upload(file, File.basename(path), post)
|
||||
tmp = Tempfile.new
|
||||
tmp.write(File.read(path))
|
||||
tmp.rewind
|
||||
create_upload(tmp, File.basename(path), post)
|
||||
ensure
|
||||
file&.close
|
||||
tmp&.close
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user