From bc86d5bc4089fdb2f7057c8d2ac66e31ffcd4ac2 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Thu, 5 Sep 2019 08:35:11 +0200 Subject: [PATCH] Fix import items to inventory (#2019) --- app/services/spreadsheet_parser.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/services/spreadsheet_parser.rb b/app/services/spreadsheet_parser.rb index ef36175f4..bfb9745fb 100644 --- a/app/services/spreadsheet_parser.rb +++ b/app/services/spreadsheet_parser.rb @@ -1,8 +1,15 @@ +# frozen_string_literal: true + class SpreadsheetParser # Based on file's extension opens file (used for importing) def self.open_spreadsheet(file) - filename = file.original_filename - file_path = file.path + if file.class == ActionDispatch::Http::UploadedFile + filename = file.original_filename + file_path = file.path + else + filename = file.filename.to_s + file_path = file.service_url + end case File.extname(filename) when '.csv'