0
0
Fork 0

Obfuscate filenames better, double rate limits

This commit is contained in:
Eugen Rochko 2017-03-14 15:59:21 +01:00
parent 952bce3023
commit 02349b3269
3 changed files with 8 additions and 4 deletions

View file

@ -13,6 +13,10 @@ module ObfuscateFilename
file = params.dig(*path)
return if file.nil?
file.original_filename = 'media' + File.extname(file.original_filename)
file.original_filename = secure_token + File.extname(file.original_filename)
end
def secure_token(length = 16)
SecureRandom.hex(length / 2)
end
end