Fixed bug #1349: OTRS Import fails with "incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)".

This commit is contained in:
Thorsten Eckel 2017-08-24 09:42:19 +02:00
parent 78a98ab51e
commit ec94c72a6b

View file

@ -38,7 +38,7 @@ module Import
Store.add( Store.add(
object: 'Ticket::Article', object: 'Ticket::Article',
o_id: local_article.id, o_id: local_article.id,
filename: decoded_filename, filename: decoded_filename.force_encoding('utf-8'),
data: decoded_content, data: decoded_content,
preferences: { preferences: {
'Mime-Type' => attachment['ContentType'], 'Mime-Type' => attachment['ContentType'],
@ -54,6 +54,9 @@ module Import
sleep rand 3 sleep rand 3
retry if !(retries -= 1).zero? retry if !(retries -= 1).zero?
raise raise
rescue => e
log "Ticket #{local_article.ticket_id} - #{sha} - #{e}: #{attachment.inspect}"
raise
ensure ensure
queue_cleanup(sha) queue_cleanup(sha)
end end