Feature/handle excel files with incorrect file extensions #127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Logic already exists to attempt to load an
xlsx_file_with_xls_extension.xls
, i.e. it's an excel file with the wrong excel extension.This PR allows the
NdrImport::File::Excel
handler to load excel workbooks that have the incorrect file extension, for example.dat
files received via Mesh. It creates a copy of the file with an updated file extension, taken from theNdrImport::Table.format
. If the format provided still doesn't work, the workbook will fail to load in the usual way.If the
NdrImport::Table.format
is an excel format, we do not create a new file. This causes a loop in the existing logic.Files created are deleted once the workbook has either loaded, or failed to load.
Also included is some light refactoring/boyscouting of the
load_workbook
method, to appease rubocop.