Feature request: Keep filenames for uploads

AI-generated summary

The discussion revolves around a feature request to preserve original filenames when uploading files to Discourse. sebastianh highlights the inconvenience of files being renamed to hashes (e.g., 07c87843ae28c0b61c8ecf1b153000513b292c47.png) when uploading assets like favicons and logos, which are often named descriptively (e.g., favicon-32.png). gerhard notes this issue has been raised before and proposes storing files in a directory based on their hash while retaining the original filename. omfg agrees, suggesting a subfolder structure (e.g., /uploads/users/user1/favicons/) could help, though acknowledges the complexity of handling duplicate filenames. sebastianh acknowledges the engineering solution (hashing) but emphasizes the need for a user-friendly way to upload logos and favicons as a built-in feature.

I hope I am not bringing something up that’s beaten around too much, but I am just getting started setting up my Discourse and on thing bothered my right off the bat.

Problem: I upload the site’s assets, a bunch of favicons, logos, etc, mostly png files, named for example favicon-32.png, or appletouch-144.png etc, basically filenames that tell me very clearly what they’re supposed to be used for, most simply favicon.ico
Now, I upload it as instructed and they all get turned into something like
/uploads/db2992/original/2X/0/07c87843ae28c0b61c8ecf1b153000513b292c47.png, leaving me to wonder which file was supposed to be which one, the only way around it being to upload them one by one and adding proper description texts in the reply posting.

Idea: Why not keep the original filenames? Turning the entire logo uploading shenanigans into proper file upload dialogs in the admin settings dashboard, where they belong, would be an entirely different, but not alltogether unrelated feature request.

Looking forward to replies, and if despite me looking and not having found it, it has already been discussed, please forgive, merge, and/or delete. Thanks for the help in advance!

This came up a few times, but I can’t find those topics anymore.

I had an idea for changing this:

Unfortunately symlinks won’t work with Amazon S3 (at least that was the case last time I checked).

2 „Gefällt mir“

Scenario A:

  • You upload your favicon.ico
  • I upload my favicon.ico

It’s cheaper and less complicated to upload my file under a random name than delete and overwrite yours.

Or, you upload a file that has a name that’s identical to whatever file is already on the server.
Sooner or later it’d start getting confusing.

2 „Gefällt mir“

I get that, that’s why one could imagine a subfolder /uploads/users/userxzy/favicon.ico and I am talking about /uploads/admin/favicon.ico etc

I know and I agree it’d like the same names would be better, but I’m quite sure they don’t randomize it just to annoy us :slight_smile:

1 „Gefällt mir“

It’s not randomized. It’s a hash of the file. So, if you upload the same file more than once it’s only stored once and it always has the filename it had at first upload.

3 „Gefällt mir“

That’s very “engineery”, another reason it would be great to offer the logo, favicon etc upload as a functionality of the admin dashboard, so I don’t have to worry about the (justifiable reasons behind) hashed filenames and all these things :slight_smile: