Skip to content

Commit

Permalink
Fix Anchor jumping with escaped query components (go-gitea#14969)
Browse files Browse the repository at this point in the history
Backport go-gitea#14969

Fix go-gitea#14968

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath committed Mar 12, 2021
1 parent 3e7dccd commit 51b02b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web_src/js/markdown/anchors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 51b02b4

Please sign in to comment.