misc.search: parse html entities and encode URI for urls

This commit is contained in:
Cynthia Foxwell 2023-01-17 20:53:15 -07:00
parent 6968680899
commit 4c78116cea

View file

@ -573,11 +573,11 @@ search.callback = async function (msg, line, args, {results = 2}) {
let out = `__**Results for \`${safeString(line)}\`**__\n`;
for (const result of searchResults) {
if (result.special_response) {
out += "> " + result.special_response.response.split("\n").join("\n> ");
out += `\n<${result.special_response.source}>`;
out += "> " + parseHtmlEntities(result.special_response.response.split("\n").join("\n> "));
out += `\n<${encodeURI(result.special_response.source)}>`;
} else {
out += `**${result.title}** - <${result.url}>`;
out += `\n> ${result.description}`;
out += `**${parseHtmlEntities(result.title)}** - <${encodeURI(result.url)}>`;
out += `\n> ${parseHtmlEntities(result.description)}`;
}
out += "\n\n";
}