Validate attachment MIME type before storing in database

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Won't Do
    • None
    • Component/s: None
    • 1
    • 3

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      Problem Definition

      Relying on MIME type information regarding JIRA issue attachments supplied by browsers can often be unreliable, causing JIRA to store attachment data with wrong MIME types in the database. This could lead to minor issues on how this attachments should be handled when downloading from the issue since the content-header is set wrongly based on the wrong MIME type recorded in the database.

      Suggested Solution

      A minor validation e.g. based on known file extensions should be used to determine the most appropriate file type when storing attachment data.

      Notes

      • It initially appeared JIRA already had such a feature based on https://jira.atlassian.com/browse/JRA-871. However after a report from a customer, I was able to personally reproduce a scenario where JIRA basically stores the wrong MIME type (text/pdf instead of application/pdf) when a PDF file was uploaded to JIRA using Firefox with corrupt MIME type definitions library. Basically this caused issues when downloading the pdf files in other browsers because the browsers tried to render the PDF file as a text file based on the content headers sent by JIRA, resulting in gibberish characters outputted on the screen.

            Assignee:
            Unassigned
            Reporter:
            Taiwo Akindele (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: