From a94972bbd2bbd92e511d8c2be39f7b4ca5b0771e Mon Sep 17 00:00:00 2001 From: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Date: Wed, 4 Jun 2025 00:20:28 +0200 Subject: [PATCH] Return the right error on /searchlog (#11174) --- server/chat-plugins/chatlog.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/chat-plugins/chatlog.ts b/server/chat-plugins/chatlog.ts index 4db71ea7b1..a9cd62ce20 100644 --- a/server/chat-plugins/chatlog.ts +++ b/server/chat-plugins/chatlog.ts @@ -911,7 +911,7 @@ export const pages: Chat.PageTable = { const parsedDate = new Date(date); const validDateStrings = ['all', 'alltime']; - const validNonDateTerm = search ? validDateStrings.includes(date) : date === 'today'; + const validNonDateTerm = date ? validDateStrings.includes(date) : date === 'today'; // this is apparently the best way to tell if a date is invalid if (isNaN(parsedDate.getTime()) && !validNonDateTerm) { throw new Chat.ErrorMessage(`Invalid date.`); @@ -928,6 +928,8 @@ export const pages: Chat.PageTable = { if (date === 'today') { this.setHTML(await LogViewer.day(roomid, LogReader.today(), opts)); if (isTime) this.send(`|scroll|div[data-server="${opts}"]`); + } else if (date === 'all' || date === 'alltime') { + return LogSearcher.runSearch(); } else if (date.split('-').length === 3) { this.setHTML(await LogViewer.day(roomid, parsedDate.toISOString().slice(0, 10), opts)); if (isTime) this.send(`|scroll|div[data-server="${opts}"]`);