Obfuscate filenames better, double rate limits
This commit is contained in:
parent
952bce3023
commit
02349b3269
3 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue