fix(admin): encode parentheses in markdown mail image URLs

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 14:21:48 +01:00
parent cd20540f13
commit 275e70b42d

View File

@@ -8,7 +8,8 @@ function escapeMarkdownAlt(alt: string): string {
/** Percent-encode spaces and parentheses in Markdown URLs (research Pitfall 4). */
function encodeMarkdownUrl(url: string): string {
return url.replace(/[ ()]/g, (ch) => encodeURIComponent(ch))
// encodeURIComponent leaves () alone; Markdown link destinations need them escaped.
return url.replace(/[ ()]/g, (ch) => (ch === ' ' ? '%20' : ch === '(' ? '%28' : '%29'))
}
function escapeHtmlAttr(value: string): string {