-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
3.5.0, 3.5.1
-
4
-
Severity 3 - Minor
-
0
-
Summary
Emails with attachments that have long UTF-8 filenames fail when processed by the Service Desk inbound mail handler due to the content-type being parsed incorrectly.
Environment
- JIRA 7.3.6
- JIRA Service Desk 3.5.0
- Gmail for both sender and inboud mail account
Steps to Reproduce
- Setup a mail handler for a service desk project in Project settings -> Email Requests
- Send an email to the mail handler to create a new request attaching a file with a long UTF-8 encoded filename
- This consistently generates a failure for example:
Еу пробо афферт лабитур вел, игнота менандри дефинитионем ех меи, сит ат ириуре ассентиор.png
- This consistently generates a failure for example:
Expected Results
Ticket is created by the mail handler, file is attached without issue.
Actual Results
The ticket gets created, but the file is not attached and a failed SQL insert is recorded in the atlassian-jira.log
The below exception is thrown in the xxxxxxx.log file:
2017-06-12 18:47:04,367 Caesium-1-1 ERROR admin [c.a.p.i.util.runner.AuthenticationContextUtilImpl] Unexpected error while running action as user 'admin' com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:FileAttachment][filename,Еу пробо афферт лабитур вел, игнота менандри дефини тионем ех меи, сит ат ириуре ассентиор.png][issue,13403][author,admin][created,2017-06-12 18:47:04.301][thumbnailable,1][mimetype,image/png; name="=?UTF-8?B?0JXRgyDQv9GA0L7QsdC+INCw0YTRhNC10YDRgiDQu9Cw0LHQuNGC0YPRgCDQstC10LssINC40LPQvQ==?= =?UTF-8?B?0L7RgtCwINC80LXQvdCw0L3QtNGA0Lgg0LTQtdGE0LjQvdC40YLQuNC+0L3QtdC8INC10YUg0LzQtdC4?= =?UTF-8?B?LCDRgdC40YIg0LDRgiDQuNGA0LjRg9GA0LUg0LDRgdGB0LXQvdGC0LjQvtGALnBuZw==?="][filesize,635096][id,11101] (SQL Exception while executing the following:INSERT INTO public.fileattachment (ID, is sueid, MIMETYPE, FILENAME, CREATED, FILESIZE, AUTHOR, zip, thumbnailable) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: value too long for type character varying(255))) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.insertAttachment(DefaultAttachmentManager.java:265) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.access$100(DefaultAttachmentManager.java:102) at com.atlassian.jira.issue.managers.DefaultAttachmentManager$5.apply(DefaultAttachmentManager.java:521) at com.atlassian.jira.issue.managers.DefaultAttachmentManager$5.apply(DefaultAttachmentManager.java:518) at com.atlassian.fugue.Either$RightProjection.map(Either.java:825) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentFromFile(DefaultAttachmentManager.java:518) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachmentImpl(DefaultAttachmentManager.java:483) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.tryCreateAttachment(DefaultAttachmentManager.java:610) at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:605) ... 3 filtered
Notes
In testing, I found that it appears the mail handler is not parsing the content-type properly and is including the file name in the mimetype field of the fileattachment table. Most of the time this simply adds the filename to the mimetype field in the fileattachment table and that does not seem to cause any other issues. However, with long UTF-8 encoded filenames the value exceeds the column's size in the database triggering the SQL exception.
This is the content-type section from the raw mail that is attached: raw-mail.txt
Content-Type: image/png; name="=?UTF-8?B?0JXRgyDQv9GA0L7QsdC+INCw0YTRhNC10YDRgiDQu9Cw0LHQuNGC0YPRgCDQstC10LssINC40LPQvQ==?= =?UTF-8?B?0L7RgtCwINC80LXQvdCw0L3QtNGA0Lgg0LTQtdGE0LjQvdC40YLQuNC+0L3QtdC8INC10YUg0LzQtdC4?= =?UTF-8?B?LCDRgdC40YIg0LDRgiDQuNGA0LjRg9GA0LUg0LDRgdGB0LXQvdGC0LjQvtGALnBuZw==?="
Workaround
No workaround has been found at this time.
- links to
[JSDSERVER-5177] Email Attachments with long UTF-8 names fail when being inserted into the database due to mime-type being parsed improperly
Labels | Original: cqt | New: cqt ril |
Remote Link | New: This issue links to "Internal ticket (Web Link)" [ 955017 ] |
UIS | Original: 1 | New: 0 |
UIS | Original: 0 | New: 1 |
UIS | Original: 1 | New: 0 |
UIS | Original: 2 | New: 1 |
UIS | Original: 12 | New: 2 |
UIS | Original: 2 | New: 12 |
UIS | Original: 1 | New: 2 |
Support reference count | Original: 3 | New: 4 |