diff options
author | nicolas <nclm@users.noreply.github.com> | 2016-11-24 20:13:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 20:13:30 +0100 |
commit | 60577f4c6ee9f4a4c9af0a41a8954e19a5f2c8cf (patch) | |
tree | 8c661ea7ceaff780965631c530ca065805c1861d /app/models | |
parent | 5e33445c5ff9ded56c2d40eb17d89ace108c3840 (diff) | |
parent | 8e34bed7cce7b97388e55fabacee7d424b5846ea (diff) |
Merge branch 'master' into french-translation
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/obfuscate_filename.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/concerns/obfuscate_filename.rb b/app/models/concerns/obfuscate_filename.rb new file mode 100644 index 000000000..dc25cdbc2 --- /dev/null +++ b/app/models/concerns/obfuscate_filename.rb @@ -0,0 +1,16 @@ +module ObfuscateFilename + extend ActiveSupport::Concern + + class_methods do + def obfuscate_filename(*args) + before_action { obfuscate_filename(*args) } + end + end + + def obfuscate_filename(path) + file = params.dig(*path) + return if file.nil? + + file.original_filename = "media" + File.extname(file.original_filename) + end +end |