Cannot upload SQL files to JIRA on Windows
Symptoms
- All attempts to upload SQL files to issues fail
- Attempts generate red error text: Unknown Server Error (500).
The following appears in the atlassian-jira.log
:
java.lang.IllegalArgumentException: Error parsing media type 'text\plain'
Diagnosis
This issue is typically seen in clients that have pgAdmin installed.
Cause
This is caused by incorrect MIME handling by Windows. When installed, the pgAdmin program associates the .SQL file extension with 'text\plain' instead of the traditional 'text/plain'.
Resolution
- Remove pgAdmin from your system as this is the root cause of the problem
- Note, this has not been throughly tested, attempt this at your own risk: It is possible to fix these in the database, before an attempt as this please shut down JIRA and backupyour database, then attempt the fix:
Perform the following select on your database:
select * from fileattachment where filename like '%.sql' and mimetype = 'text\plain';
- Review the results to ensure these are the problematic files
Perform the following update on your database:
update fileattachment set mimetype = 'text/plain' where filename like '%.sql' and mimetype = 'text\plain';
While we cannot recommend it, there is some possibility that a registry edit would be able to resolve this issue.