From 4b773f4c1d130d1acb2f177edaff8c6deb2af26c Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 22 Feb 2024 17:18:31 +0400 Subject: [PATCH] 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. --- src/contentmanager.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/contentmanager.cpp b/src/contentmanager.cpp index d5fb8f7..8c11b8a 100644 --- a/src/contentmanager.cpp +++ b/src/contentmanager.cpp @@ -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 download; try { std::pair downloadDir("dir", downloadPath.toStdString());