From d32b73d38b6f04fed3c248083ea2011ad0ffd1a8 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Tue, 16 May 2023 20:54:50 +1000 Subject: [PATCH] Set filename --- app/commands/media/upload.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/commands/media/upload.rb b/app/commands/media/upload.rb index aa5f7d3..6a40c9b 100644 --- a/app/commands/media/upload.rb +++ b/app/commands/media/upload.rb @@ -21,9 +21,10 @@ module Adamantium return Failure(:invalid_file_type) unless VALID_UPLOAD_TYPES.include? type.to_sym pathname = Time.now.strftime("%m-%Y") + uuid = SecureRandom.uuid - fullsize_filename = "#{SecureRandom.uuid}#{File.extname(file[:filename])}" - thumbnail_filename = "#{SecureRandom.uuid}-small#{File.extname(file[:filename])}" + fullsize_filename = "#{uuid}#{File.extname(file[:filename])}" + thumbnail_filename = "#{uuid}-small#{File.extname(file[:filename])}" dirname = File.join("public", "media", pathname)