# Uploads not getting orphaned and purged

**URL:** https://meta.discourse.org/t/uploads-not-getting-orphaned-and-purged/259036
**Category:** Support
**Created:** [March 22, 2023, 1:47pm UTC](https://meta.discourse.org/t/uploads-not-getting-orphaned-and-purged/259036 "2023-03-22T13:47:52Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Uphill4721](https://avatars.discourse-cdn.com/v4/letter/u/f19dbf/32.png) [@Uphill4721](https://meta.discourse.org/u/Uphill4721)
#### Post date: [March 25, 2023, 9:30am UTC](https://meta.discourse.org/t/uploads-not-getting-orphaned-and-purged/259036/6 "2023-03-25T09:30:06Z")

</div>

Going through similiar topics to gather possibly matching unsolved cases, here’s a good example on how these situations might even cause legal issues due to user uploads not getting orphaned and permanently removed like they should:

> [@I got a copyright strike to PDF file but I'm unable remove it](https://meta.discourse.org/t/i-got-a-copyright-strike-to-pdf-file-but-im-unable-remove-it/242131):
>
> Hello Everyone, I recently received a copyright strike to one PDF file but I am unable to remove it, so please assist me in this process as it is critical to the survival of my server. Regards, Sunder.

Another similiar situation all the way back from 2016:

> [@Is there a way to delete old/irrelevant uploads?](https://meta.discourse.org/t/is-there-a-way-to-delete-old-irrelevant-uploads/49284/10):
>
> My main concern is that I am maintaining and paying for uploads which nobody anymore needs and there isn`t a efficient way to clean up disk space. Even uploads from deleted topics are still kept on disk. All the occasional pornographic pictures and selfies(which users requested to be removed) from more than a year ago are still kept on the disk. I remember one case where one of my users liked Discourse upload feature so much that he attended to upload a couple chapters of comic book scans to the server.

These kinds of conditions create a huge opening for abuse and even targeted attacks for uploading illegal content that might not get permanently removed from the server even when the admins assume it would. Of course deleting single files manually straight from the filesystem is possible, but I don’t think people should be forced to take that route for such a basic need, especially when there’s a GUI setting indicating an automatic purge process and moderators often don’t have direct access to the server anyways. Also manual deletion is not practical with loads of files scattered around in different deleted topics.

**Is here enough basis for an actual bug report?** I’m still not ruling out possible misconfiguration on our end, but I’m baffled by the lack of error messages and everything else seems to be running just fine. I’ve spent a growing amount of days on troubleshooting and testing, gaining more knowledge about Discourse and its components in the process so I think with some guidance I could be able to help figuring out if there is some corner case detail triggering this weird behaviour. I hope it’s OK to ping @zogstrip at this point?

For a temporary solution, is it possible to manually move all uploads to the tombstone directory and use the upload recovery methods to restore only the non-orphan files back to their correct directories? I actually tried to do this today, but `rake uploads:recover_from_tombstone` didn’t restore any files. Could this be pointing to some bigger problem with uploads’ database entries?

---

_[View the full topic](https://meta.discourse.org/t/uploads-not-getting-orphaned-and-purged/259036)._
