We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
:file
1 parent 2011e39 commit daa2591Copy full SHA for daa2591
app/parsers/bulkrax/csv_parser.rb
@@ -341,7 +341,16 @@ def file_paths
341
file_mapping = Bulkrax.field_mappings.dig(self.class.to_s, 'file', :from)&.first&.to_sym || :file
342
next if r[file_mapping].blank?
343
344
- r[file_mapping].split(Bulkrax.multi_value_element_split_on).map do |f|
+ split_value = Bulkrax.field_mappings.dig(self.class.to_s, :file, :split)
345
+ split_pattern = case split_value
346
+ when Regexp
347
+ split_value
348
+ when String
349
+ Regexp.new(split_value)
350
+ else
351
+ Bulkrax.multi_value_element_split_on
352
+ end
353
+ r[file_mapping].split(split_pattern).map do |f|
354
file = File.join(path_to_files, f.tr(' ', '_'))
355
if File.exist?(file) # rubocop:disable Style/GuardClause
356
file
0 commit comments