do not delete tmp file if storage is local because it has yet to be copied

pull/8636/head
Markus Kahl 4 years ago
parent 50daff5062
commit f9c32e4a05
  1. 11
      modules/bim/app/contracts/bim/ifc_models/base_contract.rb

@ -77,10 +77,19 @@ module Bim
rescue ArgumentError
errors.add :base, :invalid_ifc_file
ensure
FileUtils.rm file_path if File.exists? file_path
clean_up file_path
end
end
def clean_up(file_path)
# If we are using direct uploads we can safely discard the file here straight away
# after we checked its contents. The actual file has already been uploaded to its final (remote) destination.
# For local uploads the file must remain to be copied later to its final (local) destination from the cache.
return unless OpenProject::Configuration.direct_uploads?
FileUtils.rm file_path if File.exists? file_path
end
def uploader_is_ifc_attachment_author
errors.add :uploader_id, :invalid if model.ifc_attachment && model.uploader != model.ifc_attachment.author
end

Loading…
Cancel
Save