Thema-asset-uploader "onthoudt" verkeerd bestand

AI-generated summary

In a bug report titled ‘Theme asset uploader “remembers” wrong file’, paulrudy describes an issue where renaming and re-uploading a font file (e.g., from foo.woff to bar.woff) causes Discourse to still display the original filename (foo.woff). This occurs despite the file being deleted and re-uploaded under a new name, and is observed while using BackBlaze B2 with BunnyCDN. codinghorror explains that uploaded files are matched by checksum, so Discourse likely recognizes the renamed file as identical to the original, thus reusing its metadata. paulrudy acknowledges the explanation and notes that checksum-based matching may also help prevent duplicate storage, which could be a beneficial side effect.

Hello Discourse team. First bug report, I apologize if I’ve made any mistakes.

  1. Upload a font foo.woff in the asset uploader in theme settings
  2. Delete the asset in the theme settings
  3. Rename the font locally to bar.woff
  4. Upload the renamed font

Expected behavior: Discourse accepts new upload and its name is displayed as bar.woff
Buggy behavior: The uploaded file’s name is displayed as foo.woff

Note: I am using BackBlaze B2 as my S3 assets storage in conjunction with BunnyCDN.

I’m not sure whether the bar.woff is being ignored and instead reassociated with foo.woff, or if the bar.woff is being renamed to foo.woff.

2 likes

Uploaded files (and images) are matched by checksum, so my guess is that it thinks you’re uploading the same file again. If there’s any way to change the checksum of the file, I suspect that would fix the problem, but I realize modifying a font file is a bit .. weird.

2 likes

Yeah, fontland seems like a frightening place. Thanks, I’m glad there’s a reasonable explanation, though. It sounds like the checksum matching might have the added benefit of preventing wasted storage because of duplicate uploads, which would be cool if true.

1 like