diff --git a/app/commands/media/upload.rb b/app/commands/media/upload.rb index 2bf63b8..f117dd9 100644 --- a/app/commands/media/upload.rb +++ b/app/commands/media/upload.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "securerandom" + module Adamantium module Commands module Media @@ -9,7 +11,7 @@ module Adamantium def call(file:) pathname = Time.now.strftime("%m-%Y") - filename = file[:filename].split("/").last + filename = "#{SecureRandom.uuid}#{File.extname(file[:filename])}" dirname = File.join("public", "media", pathname)