From db706243980cf0cf717337dba716a345f5253457 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 10 Jul 2023 10:51:06 +0200 Subject: [PATCH] feat(pj): change naming scheme to %Y/%m/%d/sd/sd..... --- app/jobs/pjs_migration_job.rb | 2 +- config/initializers/active_storage.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/pjs_migration_job.rb b/app/jobs/pjs_migration_job.rb index d964b3f95..4a44b59e4 100644 --- a/app/jobs/pjs_migration_job.rb +++ b/app/jobs/pjs_migration_job.rb @@ -10,7 +10,7 @@ class PjsMigrationJob < ApplicationJob client = service.client container = service.container old_key = blob.key - new_key = "#{blob.created_at.year}/#{old_key[0..1]}/#{old_key[2..3]}/#{old_key}" + new_key = "#{blob.created_at.strftime('%Y/%m/%d')}/#{old_key[0..1]}/#{old_key}" excon_response = client.copy_object(container, old_key, diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index bea706177..042333ae3 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -10,7 +10,7 @@ ActiveSupport.on_load(:active_storage_blob) do def self.generate_unique_secure_token(length: MINIMUM_TOKEN_LENGTH) token = super - "#{Time.current.year}/#{token[0..1]}/#{token[2..3]}/#{token}" + "#{Time.current.strftime('%Y/%m/%d')}/#{token[0..1]}/#{token}" end end