app/models/bulkrax/csv_entry.rb in bulkrax-4.2.1 vs app/models/bulkrax/csv_entry.rb in bulkrax-4.3.0
- old
+ new
@@ -110,15 +110,19 @@
self.parsed_metadata[source_identifier] = hyrax_record.send(work_identifier)
self.parsed_metadata[key_for_export('model')] = hyrax_record.has_model.first
end
def build_files_metadata
- file_mapping = key_for_export('file')
- file_sets = hyrax_record.file_set? ? Array.wrap(hyrax_record) : hyrax_record.file_sets
- filenames = map_file_sets(file_sets)
+ # attaching files to the FileSet row only so we don't have duplicates when importing to a new tenant
+ if hyrax_record.work?
+ build_thumbnail_files
+ else
+ file_mapping = key_for_export('file')
+ file_sets = hyrax_record.file_set? ? Array.wrap(hyrax_record) : hyrax_record.file_sets
+ filenames = map_file_sets(file_sets)
- handle_join_on_export(file_mapping, filenames, mapping['file']&.[]('join')&.present?)
- build_thumbnail_files if hyrax_record.work?
+ handle_join_on_export(file_mapping, filenames, mapping['file']&.[]('join')&.present?)
+ end
end
def build_relationship_metadata
# Includes all relationship methods for all exportable record types (works, Collections, FileSets)
relationship_methods = {