Confluence Attachment Deleted or Not Found

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

An attachment in confluence was mistakenly deleted or is "not found".

Diagnosis

The structure of attachment storage in the database has changed in Confluence 5.7, and as such the queries below will not work. However, we suspect that this issue may now no longer occur.

If you experience this on 5.7 or above, please contact Atlassian support so we can help you resolve the issue and update this page.

Confluence may still have the attachment in the filesystem, to verify preform the following in the database:

 title              | character varying(255)      | not null
 pageid             | bigint                      | not null

 

(info) The title and pageid are the most reliable ways to search for the missing document.

  • Select query using title:

    SELECT * FROM attachments WHERE title = '<title of attachment>';
  • Select query using pageid:

    SELECT * FROM attachments WHERE pageid = <page ID>;
    


You're in luck if the attachment was found via one of the methods above and the attachment can be located in the Confluence filesystem.

Note: If you have an Atlassian Cloud instance you will not be able to perform the diagnosis or fix yourself, if you wish for Atlassian Cloud Support to perform this for you please file a support request and reference this article.

Resolution

  • If the attachment was retrieved by using one of the methods under Diagnosis, a table much like the following should be displayed:

     attachmentid    |               title                |   contenttype    |   pageid   |  
    <attachmentid>   |        <title of attachment>       |  <contenttype>   |  <page ID> |
    (1 row)
    

    (info) Take note of the <attachmentid>, this will be used to search the filesystem.

  • Move to the Confluence attachments directory in the filesystem

    $ cd /data/jirastudio/confluence/home/attachments/ 
  • Find the attachmentid and move to that directory

    $ find -name <attachmentid> 
    ./41/233/983041/161/31/2031661/<attachmentid>
    $ cd /41/233/983041/161/31/2031661/<attachmentid>
    $ ls
    1  2  3 

    (info) If a list of numbers appear as above, these represent versions of the attachment.

  • scp the desired version(s) to your machine

     $ scp root@<base_url>:/data/jirastudio/confluence/home/attachments/ver003/172/129/2129922/196/150/37650446/<attachmentid>/3 /Desktop .
  • Restore the attachment to it's desired location in Confluence

Last modified on Apr 11, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.