mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 13:48:55 +08:00
parent
5da7c2a4ad
commit
e4a9242ada
@ -42,8 +42,11 @@ class HandleChunkUpload
|
|||||||
tmp_directory = @params[:tmp_directory]
|
tmp_directory = @params[:tmp_directory]
|
||||||
|
|
||||||
# delete destination files
|
# delete destination files
|
||||||
File.delete(upload_path)
|
begin
|
||||||
File.delete(tmp_upload_path)
|
File.delete(upload_path)
|
||||||
|
File.delete(tmp_upload_path)
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
end
|
||||||
|
|
||||||
# merge all the chunks
|
# merge all the chunks
|
||||||
File.open(tmp_upload_path, "a") do |file|
|
File.open(tmp_upload_path, "a") do |file|
|
||||||
@ -59,7 +62,10 @@ class HandleChunkUpload
|
|||||||
FileUtils.mv(tmp_upload_path, upload_path, force: true)
|
FileUtils.mv(tmp_upload_path, upload_path, force: true)
|
||||||
|
|
||||||
# remove tmp directory
|
# remove tmp directory
|
||||||
FileUtils.rm_rf(tmp_directory)
|
begin
|
||||||
|
FileUtils.rm_rf(tmp_directory)
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user