diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-05-22 03:15:48 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-05-22 03:18:34 -0400 |
commit | 5af52b992a3ea7298f302814a332609da3bf8125 (patch) | |
tree | c6bf77ee4535c1c6a1e9289ca1caa9429a46f6a0 /lib/Spreadsheet/ParseXLSX.pm | |
parent | 19c787c43a7559189c12b89bfe4523e012a6ec1d (diff) | |
download | spreadsheet-parsexlsx-5af52b992a3ea7298f302814a332609da3bf8125.tar.gz spreadsheet-parsexlsx-5af52b992a3ea7298f302814a332609da3bf8125.zip |
better error message when loading xls files (#52)
encrypted xlsx files use the same file container format as xls files,
and so our simple heuristic here will identify xls files as encrypted
xlsx files - we should bail out if we can't find encrypted data instead
Diffstat (limited to 'lib/Spreadsheet/ParseXLSX.pm')
-rw-r--r-- | lib/Spreadsheet/ParseXLSX.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm index a9b501f..cf9319a 100644 --- a/lib/Spreadsheet/ParseXLSX.pm +++ b/lib/Spreadsheet/ParseXLSX.pm @@ -71,10 +71,11 @@ sub parse { my $workbook = Spreadsheet::ParseExcel::Workbook->new; if ($self->_check_signature($file)) { - $file = Spreadsheet::ParseXLSX::Decryptor->open( + my $decrypted_file = Spreadsheet::ParseXLSX::Decryptor->open( $file, $self->{Password} ); + $file = $decrypted_file if $decrypted_file; } if (openhandle($file)) { |