mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-31 03:59:51 +08:00
Fix import items to inventory (#2019)
This commit is contained in:
parent
59a85d8181
commit
bc86d5bc40
1 changed files with 9 additions and 2 deletions
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue