Fixed issue #582 - Long content type shows warning and gets cut.
This commit is contained in:
parent
e16a7e8f8a
commit
6fab80adee
2 changed files with 11 additions and 5 deletions
|
@ -69,10 +69,7 @@ module Import
|
||||||
|
|
||||||
def map(article)
|
def map(article)
|
||||||
mapped = map_default(article)
|
mapped = map_default(article)
|
||||||
# if no content type is set make sure to remove it
|
map_content_type(mapped)
|
||||||
# so Zammad can set the default content type
|
|
||||||
mapped.delete(:content_type) if mapped[:content_type].blank?
|
|
||||||
mapped
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def map_default(article)
|
def map_default(article)
|
||||||
|
@ -85,6 +82,15 @@ module Import
|
||||||
.merge(article_sender_type(article))
|
.merge(article_sender_type(article))
|
||||||
end
|
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)
|
def article_type(article)
|
||||||
@article_types[article['ArticleType']] || @article_types['note-internal']
|
@article_types[article['ArticleType']] || @article_types['note-internal']
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ RSpec.describe Import::OTRS::Article do
|
||||||
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
|
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
|
||||||
to: 'Postmaster',
|
to: 'Postmaster',
|
||||||
cc: '',
|
cc: '',
|
||||||
content_type: 'text/plain; charset=utf-8',
|
content_type: 'text/plain',
|
||||||
subject: 'test #3',
|
subject: 'test #3',
|
||||||
in_reply_to: '',
|
in_reply_to: '',
|
||||||
message_id: '',
|
message_id: '',
|
||||||
|
|
Loading…
Reference in a new issue