From d3890a61173b704c9c3f933291c77d0365dd4ece Mon Sep 17 00:00:00 2001 From: f Date: Tue, 16 Feb 2021 18:08:42 -0300 Subject: [PATCH] saltearse archivos ya migrados --- app/models/metadata_file.rb | 10 +++++----- app/models/site/static_file_migration.rb | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/metadata_file.rb b/app/models/metadata_file.rb index fcabf05..8fecf55 100644 --- a/app/models/metadata_file.rb +++ b/app/models/metadata_file.rb @@ -73,10 +73,14 @@ class MetadataFile < MetadataTemplate end end + def key_from_path + path.dirname.basename.to_s + end + private def path? - !value['path'].blank? + value['path'].present? end def filemagic @@ -100,10 +104,6 @@ class MetadataFile < MetadataTemplate end end - def key_from_path - path.dirname.basename.to_s - end - # Hacemos un link duro para colocar el archivo dentro del repositorio # y no duplicar el espacio que ocupan. Esto requiere que ambos # directorios estén dentro del mismo punto de montaje. diff --git a/app/models/site/static_file_migration.rb b/app/models/site/static_file_migration.rb index 798601a..614f63d 100644 --- a/app/models/site/static_file_migration.rb +++ b/app/models/site/static_file_migration.rb @@ -42,6 +42,7 @@ class Site metadata = doc.public_send(field) next if metadata.value['path'].blank? + next if ActiveStorage::Blob.find_by(key: metadata.key_from_path) path = Pathname.new(metadata.value['path'])