Deleted a dubious piece of code

In theory, a book recorded in a local library may have only its url defined
(and no path to a ZIM file). Such a book qualifies as downloadable too.

That's why the call to `ContentManager::getRemoteOrLocalBook()` (which
may return a "local" book) perfectly makes sense in
`ContentManager::downloadBook()`.

However, it doesn't then make sense to raise an error if the returned
book turns out to be a "local" one. It would be more logical to request
only for a remote book and report an error if that operation fails.
This commit is contained in:
Veloman Yunkan 2024-02-22 17:18:31 +04:00
parent ef1489193e
commit 4b773f4c1d

View File

@ -505,15 +505,10 @@ void ContentManager::downloadBook(const QString &id)
throwDownloadUnavailableError();
const auto& book = getRemoteOrLocalBook(id);
auto downloadPath = KiwixApp::instance()->getSettingsManager()->getDownloadDir();
checkEnoughStorageAvailable(book, downloadPath);
auto booksList = mp_library->getBookIds();
for (auto b : booksList) {
if (b.toStdString() == book.getId())
throwDownloadUnavailableError(); // but why???
}
std::shared_ptr<kiwix::Download> download;
try {
std::pair<std::string, std::string> downloadDir("dir", downloadPath.toStdString());