mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
ensure that zip tmpfile gets deleted on error
This commit is contained in:
parent
ce21e9a519
commit
29d65b4d16
1 changed files with 13 additions and 8 deletions
|
@ -780,6 +780,7 @@ class Site < Sequel::Model
|
|||
tmpfile = Tempfile.new 'neocities-site-zip'
|
||||
tmpfile.close
|
||||
|
||||
begin
|
||||
Zip::Archive.open(tmpfile.path, Zip::CREATE) do |ar|
|
||||
ar.add_dir(zip_name)
|
||||
|
||||
|
@ -792,6 +793,10 @@ class Site < Sequel::Model
|
|||
end
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
tmpfile.unlink
|
||||
raise e
|
||||
end
|
||||
|
||||
tmpfile.path
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue