Merge pull request #6753 from opf/fix/clean_up_tmp_files

make sure to delete tmp files
pull/6757/head
ulferts 6 years ago committed by GitHub
commit 49643f4abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      app/workers/extract_fulltext_job.rb

@ -44,6 +44,8 @@ class ExtractFulltextJob < ApplicationJob
init
update
ensure
FileUtils.rm @file.path if delete_file?
end
private
@ -79,4 +81,12 @@ class ExtractFulltextJob < ApplicationJob
def find_attachment(id)
Attachment.find_by_id id
end
def remote_file?
!@attachment.file.is_a?(LocalFileUploader)
end
def delete_file?
remote_file? && @file
end
end

Loading…
Cancel
Save