Uploaded Files Not Deleted After Post Rejection – Causes Unnecessary Resource Retention

Maybe a bug?

In Discourse, when a post is submitted and enters the review queue, any uploaded files associated with it seem to persist even after the post is rejected. I manually rejected a user’s post and even permanently deleted the system-generated private message that notified the user about the review result, but the uploaded image from that post is still visible in the review queue and stored on the server.

This kind of leftover media is problematic because it pollutes the site with unused or potentially inappropriate content, which negatively impacts the health and cleanliness of the community ecosystem.

Is this expected behavior? Shouldn’t Discourse automatically delete uploads from rejected posts? And is there any way to clean these up manually if not?

Orphaned uploads are cleared after a time with a scheduled sidekiq job.

settings: clean_up_uploads, clean_orphan_uploads_grace_period_hours

2 Likes

Sorry, I feel that I’ve already explained it clearly enough, but perhaps my English still needs improvement. I understand that isolated files will be cleaned up. The problem now is: if an uploaded file ends up in the review queue, it will never become an isolated file. I have already rejected the post in the review queue, and I even deleted the system’s rejection message sent to the user. However, the uploaded file can still be seen in the review queue. It hasn’t become an isolated file — that’s the issue.

1 Like

Ah thanks for the clarification, apologies that I missed that detail.

Yeah I see the problem, I guess one possible solution would be to have some sort of retention setting for review queue so eventually we clear up old rejected images.

I let the product team know.

2 Likes