Skip to content

Commit b4328d7

Browse files
authored
Add import_url to file set attributes (#979)
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
1 parent 8f6dd70 commit b4328d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/factories/bulkrax/valkyrie_object_factory.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def prep_fileset_content(attrs)
271271
thumbnail_url = HashWithIndifferentAccess.new(self.attributes)['thumbnail_url']
272272
all_remote_files = merge_thumbnails(remote_files: attrs["remote_files"], thumbnail_url: thumbnail_url)
273273
# combine local & remote files [Array < Hash &/or String]
274-
all_local_files = self.attributes['file']
274+
all_local_files = self.attributes['file'] || []
275275
all_files = all_local_files + all_remote_files
276276

277277
# collect all uploaded files [Array < Hyrax::UploadedFile]
@@ -307,7 +307,9 @@ def file_set_params_for(uploads:, files:)
307307
when String
308308
{}
309309
else
310-
f.reject { |key, _| key.to_s == 'url' || key.to_s == 'file_name' }
310+
temp = f.reject { |key, _| key.to_s == 'url' || key.to_s == 'file_name' }
311+
temp['import_url'] = f['url']
312+
temp
311313
end
312314
end
313315

0 commit comments

Comments
 (0)