Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
7.4.1
-
None
-
7.04
-
6
-
Severity 3 - Minor
-
0
-
Description
Summary
When creating tickets/comments in JIRA via email, if an attachment is added to the email processed by JIRA, this attachment is added to the created/commented ticket as well.
For most attachment types, this is not a problem, but PDFs are failing to be previewed in the issue when added this way when using a Gmail account (not tested in others) as Email Server accessed by JIRA (not the user's source email).
This is happening because JIRA registered the ‘mime type’ for attachments in the ‘fileattachment’ table. All attachments added by email have a mime type in uppercase for some reason.
For most attachments, this is not a problem, but JIRA is not able to preview PDFs with uppercase in mime type.
Environment
This was only tested with Gmail in external emails.
Steps to Reproduce
- Create a test Gmail account
- Create an Email Server connecting to the Gmail account and a handler to process the emails and create comments
- Send an email message with a PDF attached to the Gmail account to either create a new ticket or comment and existing one
- Navigate to the issue and click the PDF attachment
Expected Results
The issue created/commented has a PDF attachment that when clicked previews the PDF in the browser (doesn’t download it).
Actual Results
The PDF attachment is not identified as PDF, cannot be previewed and when clicked causes the file to be downloaded, not previewed.
Notes
Here’s is the difference between a PDF added via email and added in the UI:
jira=# select * from fileattachment where issueid in (select jiraissue.id from jiraissue join project on jiraissue.project = project.id where project.pkey = 'TP' and jiraissue.issuenum = 1); id | issueid | mimetype | filename | created | filesize | author | zip | thumbnailable ------+---------+-----------------+--------------------------------+----------------------------+----------+----------+-----+--------------- 10004 | 10000 | application/pdf | pdf_added_in_ui.pdf | 2016-01-27 19:45:09.801-02 | 20597 | sysadmin | | 0 10002 | 10000 | APPLICATION/PDF | pdf-attached_email.pdf | 2016-01-27 19:30:41.117-02 | 20597 | admin | | 0
The first one can be previewed when clicked, while the second one when clicked in the issue is downloaded.
Also, if you take a PDF that is working (can be preview and its mime type is in lowercase in the database) and change the mime type to uppercase and re-index JIRA, this PDF will have the same problem as the ones added by email. This shows that indeed the uppercase is what prevents these attachments from being previewed.
Workaround
None so far.
Attachments
Issue Links
- is cloned from
-
JRACLOUD-65556 Mime types for email attachments are in uppercase and PDFs fail to be previewed
- Closed
- is related to
-
JSDSERVER-5844 Attaching a PDF file via an email reply will prevent that PDF from displaying in the preview for the Agent - invalid mimetype
- Closed
-
JRASERVER-72044 Jira Mail Handler when configured with GMAIL is not storing the file MIME type correctly in the DB when processing any incoming mail with any type of attachment.
- Gathering Impact