Discourse won't delete attachment after period hours

Version: 3.2.0.beta3-dev in docker self host.
Settings: I set clean orphan uploads grace period hours to 1 hour.

What i want

Rename the attachment after i uploaded.

1.txt and 2.txt is the same file but different file name in below describtions.

Steps

  1. I upload an 1.txt file to a post, saved.
  2. After 5 minutes, i edit the post and remove 1.txt link, saved.
  3. I rename 1.txt to 2.txt.
  4. I reupload 2.txt to the post after 1 hour.
  5. The attachment still name as 1.txt. NOT 2.txt.

But in this situation, clean orphan settings works.

  1. Upload 1.txt
  2. NOT save the post
  3. After 1 hour, i reupload the 2.txt file
  4. The new attachment link will be 2.txt when download.

That situation is different thing than clean orphan uploads.. does, isn’t it?

Perhaps I’m misunderstanding.

As far as I know, the only way to rename the file after uploading is to remove it and wait for Discourse to delete it, and then reupload it.

I followed this guide (edit the posts to remove the attachment links) to remove the file.

Removing means deleting from harddrive, AFAIK.

But I can confirm this behaviour. Discourse serves old file if it is only renamed (I didn’t bother check if it is really that old file or is it just using old filename with link).

I don’t know anything about code or coding, but Discourse uses somekind hashing I reckon. And as long content doesn’t change name it comes from kind of cache. If you really change that attachement Discourse changes linking too.

4 Likes