# Auto purge uploads from old deleted posts

**URL:** https://meta.discourse.org/t/auto-purge-uploads-from-old-deleted-posts/51306
**Category:** Feature
**Created:** [October 9, 2016, 5:35pm UTC](https://meta.discourse.org/t/auto-purge-uploads-from-old-deleted-posts/51306 "2016-10-09T17:35:57Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![gabriel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gabriel/32/367911_2.png) [@gabriel](https://meta.discourse.org/u/gabriel)
#### Post date: [December 1, 2025, 6:49pm UTC](https://meta.discourse.org/t/auto-purge-uploads-from-old-deleted-posts/51306/6 "2025-12-01T18:49:16Z")

</div>

Hey! I think this got somewhat [fixed](https://github.com/discourse/discourse/pull/36020) in the last week…

We now have an automation\[1\] to remove deleted posts upload markdown, for example:

```plaintext
 Hey it is a regular post with a link to [Discourse](https://www.discourse.org) 
 and an image: ![logo.png|100x200](upload://gj6GJHlc1Sa5YXuGz549oXBbcFv.png)
 and a file: [small.pdf|attachment](upload://3bWzVVoRhUXxi7tiPenInoebHyX.pdf) (130 Bytes)

```

When the automation has run in this post, this will be the revisioned version:

```plaintext
 Hey it is a regular post with a link to [Discourse](https://www.discourse.org) 
 and an image:
 and a file: 

```

And because these uploads are now `orphans`, they will be picked up by the [cleanup uploads job](https://github.com/discourse/discourse/blob/f413e1b0de8c326a12da29f7a4bfa3a6eed004d1/app/jobs/scheduled/clean_up_uploads.rb#L4)

* * *

Also, if you are self-hosted, you can update the cache control directives with `s3_stale_while_revalidate` and `s3_max_age` settings

* * *

1. `Remove upload markup in deleted posts` is the automation name

---

_[View the full topic](https://meta.discourse.org/t/auto-purge-uploads-from-old-deleted-posts/51306)._
