From b7b46e9a826ad6f7f86e0a495451bad70a33780e Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 20 Aug 2019 15:54:28 +0200 Subject: [PATCH] Improve clone of procedure attachements --- app/models/procedure.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 7871e6ac4..b669122a0 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -262,8 +262,10 @@ class Procedure < ApplicationRecord if original_attachment.attached? kopy.send(attribute).attach({ io: StringIO.new(original_attachment.download), - filename: original_attachment.blob.filename, - content_type: original_attachment.blob.content_type + filename: original_attachment.filename, + content_type: original_attachment.content_type, + # we don't want to run virus scanner on cloned file + metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE } }) end end