Problem with SQL attachments

We have recently noticed a problem with SQL attachments.

Some attachments with extension .sql cannot be accessed. After click on attachment browser (Mozilla 19, Mozilla 25, Chrome, IE 11, Safari 5.1.7, Opera 11.60) open empty window. Right click/Save as results in empty file (size 0 byte).

Attachments are stored correctly in file system.

We have come to conclusion that problem is in mime type.

In database (mysql) .sql attachments are saved as following mime types:

mysql> select distinct(mimetype), count(*) from fileattachment where id>='45230' and filename like'%sql' group by 1;

+--------------------------+----------+

| mimetype | count(*) |

+--------------------------+----------+

| application/octet-stream | 325 |

| application/x-sql | 20 |

| text/plain | 14 |

| text/x-sql | 4 |

| text\plain/octet-stream | 225 |

+--------------------------+----------+

5 rows in set (0.03 sec)

Attachments that are inaccessible have type "text\plain/octet-stream".

I have tried solution found in http://jira.freeswitch.org/browse/FSJIRA-26?focusedCommentId=31713&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-31713

I have added following in /opt/atlassian/jira/conf/web.xml (and restarted jira)

<mime-mapping>

<extension>spx</extension>

<mime-type>audio/ogg</mime-type>

</mime-mapping>

<mime-mapping>

<extension>sql</extension>

<mime-type>text/plain</mime-type>

</mime-mapping>

<mime-mapping>

<extension>src</extension>

<mime-type>application/x-wais-source</mime-type>

</mime-mapping>

And have manually changed mimetype for existing attachments and they are ok.

New attachments are created with wrong mimetype.

How can I force that new sql attachments are created as mime "text/plain" and not "text\plain/octet-stream"?

1 answer

1 accepted

This widget could not be displayed.
Pedro Cora Atlassian Team Nov 26, 2013

Check this knowledge base article that contains a fix for this problem: https://confluence.atlassian.com/display/JIRAKB/Cannot+upload+SQL+files+to+JIRA+on+Windows

Thank You,

this have solved our problem.

On affected computer registry was changed

HKEY_CLASSES_ROOT\.sql\Content Type from "text\plain" to "text/plain"

Can I force jira that any *.sql attachment have mime type set to "text/plain"?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

576 views 25 15
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you