Attempting to Download all Attachments Displays a Not Found 404
Using the Download All Attachments functionality displays a Not Found (404) with the error "Could not create zip file for issue", as in the below screen shot:
The following appears in the
2013-01-11 10:44:29,353 http-bio-60524-exec-12 ERROR admin 644x508x1 12ast9r 172.22.2.187 /secure/attachmentzip/11700.zip [jira.web.servlet.AttachmentZipServlet] Can not create temporary zip file : /11700.zip: /var/atlassian/application-data/jira/data/attachments/LLAMA/LLAMA-31/10502 (No such file or directory) java.io.FileNotFoundException: /var/atlassian/application-data/jira/data/attachments/LLAMA/LLAMA-31/10502 (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:138) at com.atlassian.jira.issue.attachment.AttachmentZipFileCreator.toZipFile(AttachmentZipFileCreator.java:68) at com.atlassian.jira.web.servlet.AttachmentZipServlet.createAttachmentsZipFile(AttachmentZipServlet.java:274)
One or more of the attachments is missing from the file system. The missing attachment(s) can be identified from the stack trace in
atlassian-jira.log. In the above example, this is
This can be resolved by either adding the attachment back on to the filesystem or deleting the reference to it within the JIRA GUI. The problematic attachment can be identified with either of the following methods:
Identifying it with the URL
- Access the JIRA Issue.
- Mouse over the attachments. The URL of the attachment will contain the ID. For example:
server.xmlURL is http://optimus-prime:60524/jira524/secure/attachment/10502/server.xml which matches the ID of the missing attachment (10502).
- Delete the attachment using the trashcan icon.
Querying the Database
Execute the below query against the database, replacing the
pkeywith the Issue Key of the problematic issue.JIRA 6.0 and below
select a.id, a.filename from fileattachment a join jiraissue i on i.id = a.issueid where pkey = 'LLAMA-31';JIRA 6.1 and above
select a.id, a.filename from fileattachment a join jiraissue i on i.id = a.issueid where i.id = (select j.id from project p,jiraissue j where p.id=j.project and j.issuenum=<ISSUENUMBER> and p.pkey='<PROJECTKEY>');
<PROJECTKEY>with there respective values
This SQL syntax may need to be modified depending upon the DBMS used.
Identify the filename by matching it to the id. In this example, the problematic file is
server.xmlas it has the id 10502.
10500;"jar_jar_elbow_justice.jpg" 10501;"Unicorn-fantasy-30995379-1280-1024.jpg" 10502;"server.xml"
- Delete the attachment using the trashcan icon on the View Issue screen.