logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

obfuscate_filename.rb (344B)


  1. # frozen_string_literal: true
  2. module ObfuscateFilename
  3. extend ActiveSupport::Concern
  4. class_methods do
  5. def obfuscate_filename(path)
  6. before_action do
  7. file = params.dig(*path)
  8. next if file.nil?
  9. file.original_filename = SecureRandom.hex(8) + File.extname(file.original_filename)
  10. end
  11. end
  12. end
  13. end