From ec94c72a6bcc83290183d8099b70cff751f6f7a7 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 24 Aug 2017 09:42:19 +0200 Subject: [PATCH] Fixed bug #1349: OTRS Import fails with "incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)". --- lib/import/otrs/article/attachment_factory.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/import/otrs/article/attachment_factory.rb b/lib/import/otrs/article/attachment_factory.rb index ad44e663d..c68956b4c 100644 --- a/lib/import/otrs/article/attachment_factory.rb +++ b/lib/import/otrs/article/attachment_factory.rb @@ -38,7 +38,7 @@ module Import Store.add( object: 'Ticket::Article', o_id: local_article.id, - filename: decoded_filename, + filename: decoded_filename.force_encoding('utf-8'), data: decoded_content, preferences: { 'Mime-Type' => attachment['ContentType'], @@ -54,6 +54,9 @@ module Import sleep rand 3 retry if !(retries -= 1).zero? raise + rescue => e + log "Ticket #{local_article.ticket_id} - #{sha} - #{e}: #{attachment.inspect}" + raise ensure queue_cleanup(sha) end