diff --git a/src/templates/nodes/custom/comment/list_embed.pug b/src/templates/nodes/custom/comment/list_embed.pug index bdc1c910..a2c890a3 100644 --- a/src/templates/nodes/custom/comment/list_embed.pug +++ b/src/templates/nodes/custom/comment/list_embed.pug @@ -92,7 +92,9 @@ script. // If there's a comment link in the URL, scroll there function scrollToLinkedComment() { var scrollToId = location.hash; - if (scrollToId.length <= 1) return; + + // Check that it's a valid ObjectID before passing it to jQuery. + if (!/^[a-fA-F0-9]{24}$/.test(scrollToId)) return; $(scrollToId) .addClass('comment-linked')