diff --git a/app/services/import_repository/import_records.rb b/app/services/import_repository/import_records.rb index ba80a4b0a..4715dbe2a 100644 --- a/app/services/import_repository/import_records.rb +++ b/app/services/import_repository/import_records.rb @@ -17,11 +17,13 @@ module ImportRepository private def run_import_actions - @repository.import_records( - SpreadsheetParser.open_spreadsheet(@temp_file.file), - @mappings, - @user - ) + @temp_file.file.open do |temp_file| + @repository.import_records( + SpreadsheetParser.open_spreadsheet(temp_file), + @mappings, + @user + ) + end end def run_checks diff --git a/app/services/spreadsheet_parser.rb b/app/services/spreadsheet_parser.rb index 700697169..3657270e4 100644 --- a/app/services/spreadsheet_parser.rb +++ b/app/services/spreadsheet_parser.rb @@ -7,8 +7,8 @@ class SpreadsheetParser filename = file.original_filename file_path = file.path else - filename = file.filename.to_s - file_path = file.service_url + filename = File.basename(file.path) + file_path = file.path end case File.extname(filename)