]> source.dussan.org Git - gitea.git/commitdiff
Fix Anchor jumping with escaped query components (#14969)
authorzeripath <art27@cantab.net>
Fri, 12 Mar 2021 18:59:13 +0000 (18:59 +0000)
committerGitHub <noreply@github.com>
Fri, 12 Mar 2021 18:59:13 +0000 (18:59 +0000)
Fix #14968

Signed-off-by: Andrew Thornton <art27@cantab.net>
web_src/js/markdown/anchors.js

index b7d0a1f6081b0a571c95205998f5526758a32e59..62bf8c83c37d77778b9bccfbdf063fee6a26541f 100644 (file)
@@ -5,7 +5,7 @@ const headingSelector = '.markdown h1, .markdown h2, .markdown h3, .markdown h4,
 function scrollToAnchor() {
   if (document.querySelector(':target')) return;
   if (!window.location.hash || window.location.hash.length <= 1) return;
-  const id = window.location.hash.substring(1);
+  const id = decodeURIComponent(window.location.hash.substring(1));
   const el = document.getElementById(`user-content-${id}`);
   if (el) {
     el.scrollIntoView();