diff --git a/lib/import/otrs/article.rb b/lib/import/otrs/article.rb index 888f751c5..e62100f28 100644 --- a/lib/import/otrs/article.rb +++ b/lib/import/otrs/article.rb @@ -69,10 +69,7 @@ module Import def map(article) mapped = map_default(article) - # if no content type is set make sure to remove it - # so Zammad can set the default content type - mapped.delete(:content_type) if mapped[:content_type].blank? - mapped + map_content_type(mapped) end def map_default(article) @@ -85,6 +82,15 @@ module Import .merge(article_sender_type(article)) end + def map_content_type(mapped) + # if no content type is set make sure to remove it + # so Zammad can set the default content type + mapped.delete(:content_type) if mapped[:content_type].blank? + return mapped if !mapped[:content_type] + mapped[:content_type].sub!(/;\s?.+?$/, '') + mapped + end + def article_type(article) @article_types[article['ArticleType']] || @article_types['note-internal'] end diff --git a/spec/import/otrs/article_spec.rb b/spec/import/otrs/article_spec.rb index 5fe789608..c74be687b 100644 --- a/spec/import/otrs/article_spec.rb +++ b/spec/import/otrs/article_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Import::OTRS::Article do from: '"Betreuter Kunde" ,', to: 'Postmaster', cc: '', - content_type: 'text/plain; charset=utf-8', + content_type: 'text/plain', subject: 'test #3', in_reply_to: '', message_id: '',