fix(app): add URL length limit (2048 chars) to extractUrlFromText

Prevents processing excessively long URLs in content extraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-04 22:18:00 +00:00
co-authored by Claude Opus 4.6
parent 2ced4830f6
commit 2581f20ebf
@@ -27,8 +27,10 @@ function extractUrlFromText(text: string): string | undefined {
const mdLink = /\[([^\]]*)\]\((https?:\/\/[^)]+)\)/.exec(text)
const raw = mdLink ? mdLink[2] : (/(https?:\/\/[^\s)\]"'<>]+)/.exec(text)?.[1])
if (!raw?.trim()) return undefined
const trimmed = raw.trim()
if (trimmed.length > 2048) return undefined
try {
const u = new URL(raw.trim())
const u = new URL(trimmed)
if (!/^https?:$/i.test(u.protocol)) return undefined
return u.href
} catch {