From a4c5cc8b9e5749dd50ef01f94c08dd7944a6d9c1 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Sun, 28 Feb 2021 15:26:39 +0530 Subject: [PATCH] commento.js: show comment 404 only hash is an ID Signed-off-by: Adhityaa Chandrasekar --- frontend/js/commento.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/js/commento.js b/frontend/js/commento.js index a6e40b8..a860005 100644 --- a/frontend/js/commento.js +++ b/frontend/js/commento.js @@ -2105,9 +2105,13 @@ function loadHash() { if (window.location.hash) { if (window.location.hash.startsWith("#commento-")) { - var el = $(ID_CARD + window.location.hash.split("-")[1]); + var id = window.location.hash.split("-")[1]; + var el = $(ID_CARD + id); if (el === null) { - errorShow("The comment you're looking for no longer exists. Perhaps it was deleted by the commenter or a moderator?"); + if (id.length === 64) { + // A hack to make sure it's a valid ID before showing the user a message. + errorShow("The comment you're looking for no longer exists or was deleted."); + } return; }