# Draft entries in table upload\_references doesn't get removed. Points to non-existant drafts

**URL:** https://meta.discourse.org/t/draft-entries-in-table-upload-references-doesnt-get-removed-points-to-non-existant-drafts/301452
**Category:** Bug
**Tags:** uploads
**Created:** [March 29, 2024, 1:26am UTC](https://meta.discourse.org/t/draft-entries-in-table-upload-references-doesnt-get-removed-points-to-non-existant-drafts/301452 "2024-03-29T01:26:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![groove6j](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/groove6j/32/367325_2.png) [@groove6j](https://meta.discourse.org/u/groove6j)
#### Post date: [March 29, 2024, 1:26am UTC](https://meta.discourse.org/t/draft-entries-in-table-upload-references-doesnt-get-removed-points-to-non-existant-drafts/301452/1 "2024-03-29T01:26:56Z")

</div>

Hello!  
I’m referencing to [this thread](https://meta.discourse.org/t/uploads-not-getting-orphaned-and-purged/259036/7), because this seems to be a bug.  
I will try to explain as simple as I can in my understanding:

Every time a post (containing uploads - images, files etc.) is being edited or being newly created, there is a new entry created in **upload\_references** table with **target\_type** - Draft (which seems correct, because at that time it is a Draft and it contains a upload).  
Also a new entry in the table **drafts** is created at that time - also seems normal.

BUT… after post being finished editing or finished creating, the specific entry in **upload\_references** should be either removed or it’s **target\_type** changed to Post (because it is no longer a Draft).

Entry in table **drafts** gets removed. Entry in table **upload\_references** doesn’t!

The result is **upload\_references** table [growing with tons of references](https://meta.discourse.org/uploads/short-url/gdMEhZ3My85lm2CHNX3oq1D30NL.csv) to non-existing drafts.  
Also this prevents uploads to get cleaned and orphan files getting purged, which leads to illegal hosting/rapidly growing uploads folder etc.

The issue is there since I installed the forum (3.3.0.beta1-dev) and I had no plugins installed at that time. I can provide any information necessary.
