Skip in-epub file if it is not found, except it's the container.
We skipped the whole EPUB before.
This commit is contained in:
parent
5bd1030ad8
commit
ba5716c585
14
src/zip.cpp
14
src/zip.cpp
|
@ -39,6 +39,7 @@ namespace epubgrep::zip
|
|||
|
||||
using boost::locale::translate;
|
||||
using fmt::format;
|
||||
using std::cerr;
|
||||
|
||||
std::vector<std::string> list(const fs::path &filepath)
|
||||
{
|
||||
|
@ -112,8 +113,19 @@ std::string read_file(const fs::path &filepath, std::string_view entry_path)
|
|||
|
||||
close_file(zipfile, filepath);
|
||||
|
||||
throw exception{format(translate("{0:s} not found in {1:s}.").str(),
|
||||
if (entry_path == "META-INF/container.xml")
|
||||
{ // File is probably not an EPUB.
|
||||
exception e{format(translate("{0:s} not found in {1:s}.").str(),
|
||||
entry_path, filepath.string())};
|
||||
e.code = 1;
|
||||
throw exception{e};
|
||||
}
|
||||
|
||||
cerr << translate("WARNING: ")
|
||||
<< format(translate("{0:s} not found in {1:s}.").str(), entry_path,
|
||||
filepath.string())
|
||||
<< '\n';
|
||||
return {};
|
||||
}
|
||||
|
||||
struct archive *open_file(const fs::path &filepath)
|
||||
|
|
Loading…
Reference in New Issue
Block a user