Return http 400 error response when needed.

This commit is contained in:
Matthieu Gautier committed 2022-03-28 17:37:41 +02:00
1 parent b1643e422e
commit e7293346be
2 files changed
+87 -17

No files matched your search

+7 -2
View File
@@ -526,8 +526,13 @@ std::unique_ptr<Response> InternalServer::handle_search(const RequestContext& re
} catch (const std::out_of_range&) {}
/* Make the search */
if ( (!archive && !bookName.empty())
|| (patternString.empty() && ! has_geo_query) ) {
if (patternString.empty() && ! has_geo_query) {
return HTTP400HtmlResponse(*this, request)
+ invalidUrlMsg
+ std::string("No query provided.");
}
if (!archive && !bookName.empty()) {
auto data = get_default_data();
data.set("pattern", encodeDiples(patternString));
data.set("root", m_root);