From c574735f515f18cf846a0d4df2f7ee879c198ec8 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 16 Jan 2022 18:02:52 +0400 Subject: [PATCH] makeFulltextSearchSuggestion() works via mustache --- src/server/internalServer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index 04864142e..3dda112bd 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -444,7 +444,13 @@ namespace std::string makeFulltextSearchSuggestion(const std::string& queryString) { - return "containing '" + queryString + "'..."; + MustacheData data; + data.set("SEARCH_TERMS", queryString); + // NOTE: Search terms are **not** HTML-escaped at this point. + // NOTE: HTML-escaping is performed when the result of this function + // NOTE: is expanded into the suggestions.json template + const std::string tmpl("containing '{{{SEARCH_TERMS}}}'..."); + return render_template(tmpl, data); } std::string noSuchBookErrorMsg(const std::string& bookName)