Merge pull request #3563 from pengfeidong/fix_3440_clone_procedure_with_attachments
[fix #3440] use attachment.download for get attachment file
This commit is contained in:
commit
0cc36aea3b
1 changed files with 4 additions and 7 deletions
|
@ -454,13 +454,10 @@ class Procedure < ApplicationRecord
|
||||||
def clone_attachment(cloned_procedure, attachment_symbol)
|
def clone_attachment(cloned_procedure, attachment_symbol)
|
||||||
attachment = send(attachment_symbol)
|
attachment = send(attachment_symbol)
|
||||||
if attachment.attached?
|
if attachment.attached?
|
||||||
response = Typhoeus.get(attachment.service_url, timeout: 5)
|
cloned_procedure.send(attachment_symbol).attach(
|
||||||
if response.success?
|
io: StringIO.new(attachment.download),
|
||||||
cloned_procedure.send(attachment_symbol).attach(
|
filename: attachment.filename
|
||||||
io: StringIO.new(response.body),
|
)
|
||||||
filename: attachment.filename
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue