User lmcthjo asked how to restore missing attachments after some users reported missing pictures and attachments on Discourse 1.9.0. They were able to restore pictures by copying from tombstone folder to default folder but this did not work for attachments. pfaffman suggested searching for “recover from tombstone” for solutions. codinghorror asked @vinothkannans for advice, wondering if there was an existing topic.
vinothkannans responded that the files seem available but the upload records are missing from the database. They suggested running ‘rake uploads:recover’ to fix, and setting ‘purge deleted uploads grace period days’ to max first to avoid data loss. If that does not work, try upgrading Discourse and run the rake task again.
Hi, recently some users complained about missing pictures and not able to download attachments. we are running old discourse 1.9.0 beta15 and plan to upgrade to latest version.
After investigation, I was able to restore pictures by copy/paste from ‘tombstone’ folder to ‘default’ folder. (As a workaround)
Pictures are visible as before. Fine.
Unfortunately, doing the same for missing attachments doesn’t work. Even if I restore file (.zip, .html, txt, etc) in correct location, discourse displays “Oops! that page doesn’t exist or is private”.
For zip file, if I try to download it, I see “Failed - no file”
Is there anything else I can do to repair this?
In the case I cannot fix attachments, the restore of our DB backup in new version of discourse could be affected as well?
It sounds like the files available in the correct location but the upload records are not found in DB. In that case, non-image uploads won’t be downloaded even if they’re available in local storage. You should run the rake uploads:recover rake task to fix the issue. Before, set the site setting purge deleted uploads grace period days value to the maximum to prevent the loss of data.
If the above rake task didn’t fix the issue then you should upgrade to the latest version and try the rake task again.