mirror of
https://github.com/litruv/lit.ruv.wtf.git
synced 2026-12-05 04:45:47 +11:00
fix: Update URL sanitization logic in Markdown renderer
This commit is contained in:
1 parent
4e4665c4ca
commit
01bac4c0bd
1 file changed
+1
-1
@@ -402,7 +402,7 @@ export class MarkdownRenderer {
|
||||
static #sanitizeUrl(url) {
|
||||
const trimmed = url.trim();
|
||||
// Allow absolute URLs, root-relative, hash links, relative-dot paths, and plain relative paths
|
||||
if (/^(https?:\/\/|mailto:|blob:|\/|#|\.)/.test(trimmed)) return trimmed;
|
||||
if (/^(https?:\/\/|mailto:|\/|#|\.)/.test(trimmed)) return trimmed;
|
||||
// Allow relative paths (e.g. data/blog/media/image.png) — no protocol = safe relative
|
||||
if (/^[a-zA-Z0-9_\-][a-zA-Z0-9_.\-\/]*$/.test(trimmed)) return trimmed;
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user