Skip to content

Commit b8328a7

Browse files
/catalog/search?count=0 returns all entries
1 parent 08c3a9d commit b8328a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/server/internalServer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,8 @@ InternalServer::search_catalog(const RequestContext& request,
720720
const auto totalResults = bookIdsToDump.size();
721721
const size_t count = request.get_optional_param("count", 10UL);
722722
const size_t startIndex = request.get_optional_param("start", 0UL);
723-
bookIdsToDump = subrange(bookIdsToDump, startIndex, count);
723+
const size_t intendedCount = count > 0 ? count : bookIdsToDump.size();
724+
bookIdsToDump = subrange(bookIdsToDump, startIndex, intendedCount);
724725
opdsDumper.setOpenSearchInfo(totalResults, startIndex, bookIdsToDump.size());
725726
return bookIdsToDump;
726727
}

test/server.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -939,8 +939,11 @@ TEST_F(LibraryServerTest, catalog_search_results_pagination)
939939
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
940940
" <totalResults>3</totalResults>\n"
941941
" <startIndex>0</startIndex>\n"
942-
" <itemsPerPage>0</itemsPerPage>\n"
942+
" <itemsPerPage>3</itemsPerPage>\n"
943943
CATALOG_LINK_TAGS
944+
CHARLES_RAY_CATALOG_ENTRY
945+
RAY_CHARLES_CATALOG_ENTRY
946+
UNCATEGORIZED_RAY_CHARLES_CATALOG_ENTRY
944947
"</feed>\n"
945948
);
946949
}

0 commit comments

Comments
 (0)