mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-03 22:19:27 +00:00
fix: decode URL-encoded hash fragment before getElementById lookup
Anchors with special characters (e.g. spaces encoded as %20) would fail the getElementById lookup because the raw URL-encoded string doesn't match the element's id attribute. Apply decodeURIComponent() with a try/catch fallback to handle malformed URIs gracefully.
This commit is contained in:
@@ -12,7 +12,13 @@
|
||||
var hash = window.location.hash;
|
||||
if (!hash) return;
|
||||
|
||||
var id = hash.substring(1);
|
||||
var rawId = hash.substring(1);
|
||||
var id;
|
||||
try {
|
||||
id = decodeURIComponent(rawId);
|
||||
} catch (e) {
|
||||
id = rawId;
|
||||
}
|
||||
var el = document.getElementById(id);
|
||||
if (el) {
|
||||
el.scrollIntoView();
|
||||
|
||||
Reference in New Issue
Block a user