Skip to content

Commit

Permalink
🐛 Fix CSV file path handling in zip imports
Browse files Browse the repository at this point in the history
When re running a single entry, a nil file path was getting sent to #read_data and thus resulted in the StandardError.

The issue is in real_import_file_path where we're returning too early when file? && zip? is true but no CSV files are found in the unzipped directory.
  • Loading branch information
Shana Moore committed Jan 27, 2025
1 parent 0e8de61 commit 24e584d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/parsers/bulkrax/csv_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ def unique_collection_identifier(collection_hash)
# We expect a single CSV at the top level of the zip in the CSVParser
# but we are willing to go look for it if need be
def real_import_file_path
return Dir["#{importer_unzip_path}/**/*.csv"].reject { |path| in_files_dir?(path) }.first if file? && zip?
if file? && zip?
csv_files = Dir["#{importer_unzip_path}/**/*.csv"].reject { |path| in_files_dir?(path) }
return csv_files.first if csv_files.any?
end

parser_fields['import_file_path']
end
Expand Down

0 comments on commit 24e584d

Please sign in to comment.