Merge pull request #9289 from demarches-simplifiees/new_pj_scheme

Change le nommage des pjs à %Y/%m/%d/sd/sd.....
This commit is contained in:
Colin Darie 2023-07-10 13:20:34 +00:00 committed by GitHub
commit 3885864200
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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,

View file

@ -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