Skip to content

Commit

Permalink
try default password on read failure, closes #161
Browse files Browse the repository at this point in the history
  • Loading branch information
tfussell committed Jul 6, 2019
1 parent ba01de4 commit be7a91f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion source/workbook/workbook.cpp
Expand Up @@ -865,7 +865,23 @@ void workbook::load(std::istream &stream)
{
clear();
detail::xlsx_consumer consumer(*this);
consumer.read(stream);

try
{
consumer.read(stream);
}
catch (xlnt::exception &e)
{
if (e.what() == std::string("xlnt::exception : encrypted xlsx, password required"))
{
stream.seekg(0, std::ios::beg);
consumer.read(stream, "VelvetSweatshop");
}
else
{
throw;
}
}
}

void workbook::load(const std::vector<std::uint8_t> &data)
Expand Down

0 comments on commit be7a91f

Please sign in to comment.