From fa90f4966fa1df3dad7cc6f623b764d3b5e5abec Mon Sep 17 00:00:00 2001 From: Mike Walmsley Date: Thu, 16 May 2024 16:05:44 -0400 Subject: [PATCH] Add additional metadata keys --- app/services/import/reduction.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/services/import/reduction.rb b/app/services/import/reduction.rb index 8da1e0b..8585c83 100644 --- a/app/services/import/reduction.rb +++ b/app/services/import/reduction.rb @@ -69,11 +69,19 @@ def unique_id subject_metadata = payload.dig('subject', 'metadata') return unless subject_metadata - # cosmic dawn metadata - may be marked as hidden (!id) or private (#id) metadata + # this is the standard gz metadata for all future uploads + unique_id = subject_metadata['!filename'] + return unique_id if unique_id + + # this catches various common (non-standard and to be avoided in future) variations + unique_id = subject_metadata['!Filename'] || subject_metadata['#filename'] || subject_metadata['#Filename'] || subject_metadata['filename'] || subject_metadata['Filename'] + return unique_id if unique_id + + # old cosmic dawn metadata - may be marked as hidden (!id) or private (#id) metadata unique_id = subject_metadata['id'] || subject_metadata['!id'] || subject_metadata['#id'] return unique_id if unique_id - # decals metadata + # old decals metadata unique_id = subject_metadata['#name'] return unique_id if unique_id