mirror of
https://github.com/discourse/discourse.git
synced 2025-08-21 19:11:18 +08:00
FIX: Use a tmp file in UploadRecovery
for local store.
This commit is contained in:
parent
e0e6dae6a7
commit
293cf600f0
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue