RequestContext::get_optional_param()

This commit is contained in:
Veloman Yunkan committed 2021-06-08 20:37:00 +04:00
1 parent 70d42aec98
commit b60e3ffb26
2 files changed
+11 -8

No files matched your search

+2 -8
View File
@@ -703,14 +703,8 @@ InternalServer::search_catalog(const RequestContext& request,
opdsDumper.setTitle("Search result for " + q);
std::vector<std::string> bookIdsToDump = mp_library->filter(filter);
const auto totalResults = bookIdsToDump.size();
size_t count(10);
size_t startIndex(0);
try {
count = extractFromString<unsigned long>(request.get_argument("count"));
} catch (...) {}
try {
startIndex = extractFromString<unsigned long>(request.get_argument("start"));
} catch (...) {}
const size_t count = request.get_optional_param("count", 10UL);
const size_t startIndex = request.get_optional_param("start", 0UL);
const auto s = std::min(startIndex, totalResults);
bookIdsToDump.erase(bookIdsToDump.begin(), bookIdsToDump.begin()+s);
if (count>0 && bookIdsToDump.size() > count) {