From 6e6b7fe5a645ac143f3673d9e29a49875cdb1ef8 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Fri, 24 Jul 2015 15:21:49 +0200 Subject: [PATCH] Improved logging. --- lib/import/otrs.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index 7159fcce9..3a86ebc46 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -675,11 +675,14 @@ module Import::OTRS # import article attachments article['Attachments'].each { |attachment| + + filename = Base64.decode64(attachment['Filename']) + begin Store.add( object: 'Ticket::Article', o_id: article_object.id, - filename: Base64.decode64(attachment['Filename']), + filename: filename, data: Base64.decode64(attachment['Content']), preferences: { 'Mime-Type' => attachment['ContentType'], @@ -689,7 +692,7 @@ module Import::OTRS created_by_id: 1, ) rescue ActiveRecord::RecordNotUnique - log "Ticket #{ticket_new[:id]} (article #{article_object.id}, Content-ID #{attachment['ContentID']}) is handled by another thead, skipping." + log "Ticket #{ticket_new[:id]} (article #{article_object.id}, filename #{filename}) is handled by another thead, skipping." next end }