diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index 12ad2b28e..9ac6abfd1 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -237,6 +237,14 @@ std::pair InternalServer::selectBooks(const Req if (id_vec.empty()) { throw Error(noValueForArgMsg(prefix+"id")); } + for(const auto& bookId: id_vec) { + try { + // This is a silly way to check that bookId exists + mp_nameMapper->getNameForId(bookId); + } catch (const std::out_of_range&) { + throw Error(noSuchBookErrorMsg(bookId)); + } + } const auto bookIds = Library::BookIdSet(id_vec.begin(), id_vec.end()); checkBookNumber(bookIds, m_multizimSearchLimit); const auto queryString = request.get_query([&](const std::string& key){return key == prefix+"id";}, true);