Details
-
Bug
-
Resolution: Fixed
-
Low
-
3.7.0, 3.12.2, 3.16.6
-
None
-
Severity 3 - Minor
-
Description
Summary
Attaching a PDF file via an email reply will prevent that PDF from displaying in the preview for the Agent - invalid mimetype
Steps to Reproduce
- Create a Service Desk request
- As a JSD customer, reply to the JSD issue creation notification, and include a PDF file as an attachment in your email
- As a JSD Agent, login to Jira and open that issue
- Under attachments of that issue, click on the attachment file
Expected Results
PDF files should open/display in the preview window in this case
Actual Results
This PDF file cannot be previewed. Instead the file is downloaded to the client machine.
Notes
When adding the same attachment via the customer portal, you can preview that file correctly. So there is something different the mail handler is doing here.
Found in the jiradb fileattachment table, that the mimetype field for this attachment has a value such as:
application/pdf; name="Samplefilename123.pdf"
Whereas pdf files attached in the customer portal only have a mimetype value of
application/pdf
Workaround
We strongly recommend that you create a backup of your database before you proceed with any of the steps below. Direct changes made to the SQL database can be dangerous to the integrity of your data.
I found that I could hack the database to get around this. You can find the attachments on an issue with the key TP-1 with a sql query such as:
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);
From there, you can find the id value, and perform an update to the table such as:
update fileattachment set mimetype='application/pdf' where id=10300;
Where the id of 10300 was for that entry found in the first query.
After I did this direct SQL update, I refreshed the Jira issue page and I was then able to preview this pdf file. This can work for fixing single attachments.
Attachments
Issue Links
- relates to
-
JRASERVER-66045 Mime types for email attachments are in uppercase and PDFs fail to be previewed
- Gathering Impact
- mentioned in
-
Page Loading...