Skip to content

Commit

Permalink
stop the double checking of mime type if csv or xml extraction fails.…
Browse files Browse the repository at this point in the history
… relates to #1820
  • Loading branch information
stuzart committed Jul 1, 2024
1 parent 5256a76 commit 6954ee2
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions lib/seek/content_extraction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,17 @@ def extract_text_from_pdf

def to_csv(sheet = 1, trim = false)
return '' unless is_excel?
begin
spreadsheet_to_csv(filepath, sheet, trim, Seek::Config.jvm_memory_allocation)
rescue SysMODB::SpreadsheetExtractionException
to_csv(sheet, trim) if double_check_mime_type
end

spreadsheet_to_csv(filepath, sheet, trim, Seek::Config.jvm_memory_allocation)

end

def extract_csv()
File.read(filepath)
end

def to_spreadsheet_xml
begin
spreadsheet_to_xml(filepath, Seek::Config.jvm_memory_allocation)
rescue SysMODB::SpreadsheetExtractionException=>e
if double_check_mime_type
to_spreadsheet_xml
else
raise e
end
end
spreadsheet_to_xml(filepath, Seek::Config.jvm_memory_allocation)
end

private
Expand Down

0 comments on commit 6954ee2

Please sign in to comment.