From 5a0efd2d4222572aabb9760c5c87585067f06292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 1 Nov 2021 15:30:36 -0400 Subject: [PATCH] fix: don't use # for previews --- public/src/client/topic.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index 6661b43d65..8127967292 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -201,10 +201,11 @@ define('forum/topic', [ } const href = link.attr('href'); + const validHref = href && href !== '#'; const pathname = utils.urlToLocation(href).pathname; $('#post-tooltip').remove(); - const postMatch = pathname && pathname.match(/\/post\/([\d]+)/); - const topicMatch = pathname && pathname.match(/\/topic\/([\d]+)/); + const postMatch = validHref && pathname && pathname.match(/\/post\/([\d]+)/); + const topicMatch = validHref && pathname && pathname.match(/\/topic\/([\d]+)/); if (postMatch) { const pid = postMatch[1]; if (parseInt(link.parents('[component="post"]').attr('data-pid'), 10) === parseInt(pid, 10)) {