3 ms·
A hex-encoded file hash as a file name is a safe bet. You can resolve file names (unsanitized, stored safely in a database) to hashes and load the files from di
by wyager 10y ago
A hex-encoded file hash as a file name is a safe bet. You can resolve file names (unsanitized, stored safely in a database) to hashes and load the files from disk.
This general approach (whitelisting file URLs) lets us localize any path sanitation to the file upload code, rather than every single request.