mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Make every URL the console page uses page-relative, guarded by a source test
AI Assisted
This commit is contained in:
1 parent
4ced32be5c
commit
1d007737b1
47 files changed
+401
-202
No files matched your search
@@ -73,7 +73,7 @@ function safeHref(href) {
|
||||
if (!href) return null;
|
||||
const trimmed = String(href).trim();
|
||||
const kept = KEPT_ATTACHMENT.exec(trimmed);
|
||||
if (kept) return "/attachments/" + kept[1].toLowerCase();
|
||||
if (kept) return "attachments/" + kept[1].toLowerCase();
|
||||
// Blocks javascript: and data: hrefs before they can reach the DOM, and a
|
||||
// protocol-relative `//host` (or `/\host`), which leaves the page for another site.
|
||||
return SAFE_PROTOCOL.test(trimmed) ? trimmed : null;
|
||||
|
||||
Reference in new issue
Block a user