From 98129049df75a578ba8c7b463789d5941d3825fd Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Wed, 18 Sep 2024 14:34:19 -0400 Subject: [PATCH] Add import_url to file set attributes This adds import_url to the attributes for creating a Valkyrized file set. To actually save the import_url on a file set, the application needs to: - add import_url to the file_set metadata attributes in your app - decorate Hyrax::WorkUploadsHandler to add import_url to the file_set_args method --- app/factories/bulkrax/valkyrie_object_factory.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/factories/bulkrax/valkyrie_object_factory.rb b/app/factories/bulkrax/valkyrie_object_factory.rb index 0b1bbcad..955e84f7 100644 --- a/app/factories/bulkrax/valkyrie_object_factory.rb +++ b/app/factories/bulkrax/valkyrie_object_factory.rb @@ -271,7 +271,7 @@ def prep_fileset_content(attrs) thumbnail_url = HashWithIndifferentAccess.new(self.attributes)['thumbnail_url'] all_remote_files = merge_thumbnails(remote_files: attrs["remote_files"], thumbnail_url: thumbnail_url) # combine local & remote files [Array < Hash &/or String] - all_local_files = self.attributes['file'] + all_local_files = self.attributes['file'] || [] all_files = all_local_files + all_remote_files # collect all uploaded files [Array < Hyrax::UploadedFile] @@ -307,7 +307,9 @@ def file_set_params_for(uploads:, files:) when String {} else - f.reject { |key, _| key.to_s == 'url' || key.to_s == 'file_name' } + temp = f.reject { |key, _| key.to_s == 'url' || key.to_s == 'file_name' } + temp['import_url'] = f['url'] + temp end end