From 2effd5ec95fd7dcea180c85245c845476e4b50e8 Mon Sep 17 00:00:00 2001 From: q Date: Mon, 15 Dec 2025 12:14:18 -0500 Subject: [PATCH] Fixing error message formatting --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 7e9002a..b9b9352 100644 --- a/index.js +++ b/index.js @@ -225,7 +225,7 @@ Searxng.prototype.handleMessage = function(event, room) { } } - const name = toSearch; + const name = toSearch.trim(); toSearch = encodeURIComponent(toSearch); const searchURL = this.searxngInstance + "/search?category_images=1&pageno=1&time_range=&format=json&"+this.searxngParameters+"&safesearch="+(messagePieces[0] == unsafeImageSearchCmd ? "0" : "1")+"&q=" + toSearch; @@ -240,15 +240,15 @@ Searxng.prototype.handleMessage = function(event, room) { const results = bodyObj.results; if (typeof results === 'undefined' || results == null || results.length <= 0) { - matrixClient.sendNotice(room.roomId, "No results found for \""+toSearch+"\""); + matrixClient.sendNotice(room.roomId, "No results found for \""+name+"\""); return; } else if (resultIndex > (results.length - 1)) { - matrixClient.sendNotice(room.roomId, "No result found for \""+toSearch+"\" at position "+(resultIndex+1)); + matrixClient.sendNotice(room.roomId, "No result found for \""+name+"\" at position "+(resultIndex+1)); return; } - sendImage(results, resultIndex, room.roomId, name.trim(), event.getContent().body, 0, matrixClient, uploadMatrixClient, event.getSender(), logSearches); + sendImage(results, resultIndex, room.roomId, name, event.getContent().body, 0, matrixClient, uploadMatrixClient, event.getSender(), logSearches); } else { matrixClient.sendNotice(room.roomId, "Error occurred during \"" + event.getContent().body + "\"");