fix(admin): encode parentheses in markdown mail image URLs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user