The underlying links have long been deleted - Shouldn’t that mean these .gif should seize appearing? Clicking “View Image” from the context menu takes me to a community.signalusers address, is that expected behavior?
Testing, I’ll edit this out in ~300 seconds and shortly after delete the link.
The link is deleted but the image persists in the edit history, perhaps it doesn’t have an Upload record as it isn’t removed by the automatic cleanup.
clean up uploads sounds like a general setting that would capture all images with an upload record, is that correct? Not just those present due to download_remote_images_to_local. If true, I should be able to find examples on the site of regular image uploads that aren’t being removed as a result of the automatic cleanup.
You mind me asking what the clean orphan uploads grace period hours is set to here so I can offer it as a solution. Or does it come with a default?
If they decide to enable that setting, will they need to do anything to apply it to past posts?
Just for the sake of being explicit, the thinking here is that this isn’t an issue but that a setting needs to be switched on. I just don’t want to go back and say “You need to enable this!” and they say “It is enabled!” I’ll look silly.
I also caught myself frantically looking for a place to browse uploads (familiar with it from MediaWiki) because I just know stuff gets double triple and quadruple uploaded, and sometimes I wonder where a file was that I uploaded once a while ago but maybe lost or deleted so I can link to it instead of re-uploading it yet again… I guess there is something to be said about a file browser…
I also had to somehow delete an uploaded file. We don’t have the cleanup task enabled as some files come from an import from a different forum software and have not yet been referenced in imported posts correctly. So I needed to find a manual way. The following works but is not pretty …
Make sure the relevant upload is no longer in the current version of any post. That way, Discourse will consider it orphaned and not make trouble when you delete it.
Use the Data Explorer plugin or a different way to query the Discourse database to list orphaned uploads, find the relevant one, and note down its upload_id and filename. Relevant query:
uploads.id, uploads.user_id, uploads.created_at,
LEFT OUTER JOIN post_uploads ON uploads.id = post_uploads.upload_id
WHERE post_uploads.post_id IS NULL
ORDER BY created_at DESC
In the database or with the Rails console for Discourse, delete the concerned record from table uploads by its upload ID. Here I use the Rails console:
Delete the associated file incl. all optimized versions (if any, applies to images) from the file system via SSH. Note the wildcard added before the file extension to also catch optimized versions, which have a suffix here. Of course,
find . -name 43adade7a4cc64426adb8232a56cb2c3b49fb7c9*.pdf -type f -delete