Skip to content

Commit 5c6ec9d

Browse files
committed
fix: css selector string escaping vulnerability (#888)
Resolves #888
1 parent c3a8400 commit 5c6ec9d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

_javascript/utils/smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $(function () {
2828
const hash = decodeURI(this.hash);
2929
let toFootnoteRef = RegExp(/^#fnref:/).test(hash);
3030
let toFootnote = toFootnoteRef ? false : RegExp(/^#fn:/).test(hash);
31-
let selector = hash.includes(":") ? hash.replace(/:/g, "\\:") : hash;
31+
let selector = '#' + $.escapeSelector(hash.substring(1));
3232
let $target = $(selector);
3333

3434
let isMobileViews = $topbarTitle.is(":visible");

assets/js/dist/page.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)