diff --git a/app/models/metadata_file.rb b/app/models/metadata_file.rb index fcabf05d..8fecf553 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 798601a5..614f63dd 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'])