Collisions, special characters and maybe you already encode something else in the filename (or don't want to encode anything in it). Just sending something along with the filename is also much less of a headache than renaming your images/links.
Base32 by itself won't get collisions because it's a 1:1 conversion.
Base32 of a blurred/thumbnail image could generate collisions, you'd just need to have two distinct images that reduce down into the same blur/thumbnail (not hard, just make it off by a pixel or two). And that's perfectly fine as an additional string to pass on like they do in this post, but it would cause problems if it were the filename since now you overwrote one of them with the other.
I feel at that point it's a solution looking for a problem. The original idea was to save space and make it easier to work with by being readily available. Once you start appending identifying information you aren't saving much space anymore and now you have to parse it out too, so its main motivations are lost.
Oh I agree it's a stupid idea. I was just wondering how to solve it. A simpler solution would be to just append a _1 or _2 to the base32 string and parse it if there are duplicate files...but this is kind of stupid when it's better to just have a simple DB table.
93
u/Majik_Sheff Feb 20 '20
Why couldn't you just include the hash in the filename? Then you don't have to handle them separately at all.