Fixed issue #582 - Long content type shows warning and gets cut.

This commit is contained in:
Thorsten Eckel 2017-01-13 09:20:38 +01:00
parent e16a7e8f8a
commit 6fab80adee
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -37,7 +37,7 @@ RSpec.describe Import::OTRS::Article do
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
to: 'Postmaster',
cc: '',
content_type: 'text/plain; charset=utf-8',
content_type: 'text/plain',
subject: 'test #3',
in_reply_to: '',
message_id: '',