Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-5844

Attaching a PDF file via an email reply will prevent that PDF from displaying in the preview for the Agent - invalid mimetype

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 4.5.0
    • 3.7.0, 3.12.2, 3.16.6
    • Email - Incoming
    • None

    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

      1. Create a Service Desk request
      2. As a JSD customer, reply to the JSD issue creation notification, and include a PDF file as an attachment in your email
      3. As a JSD Agent, login to Jira and open that issue
      4. 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

      Warning

      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

          Activity

            People

              Unassigned Unassigned
              aheinzer Andy Heinzer
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync