Skip to content

Commit

Permalink
Trim image src url before encoding (#639)
Browse files Browse the repository at this point in the history
  • Loading branch information
harryzcy authored Nov 18, 2023
1 parent 954c7d6 commit cb6c0dd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions web/src/utils/emails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function parseEmailContent(
if (!loadImage) {
domNode.attribs.src = ''
} else if (!disableProxy) {
domNode.attribs['data-original-src'] = domNode.attribs.src
domNode.attribs.src = makeProxyURL(domNode.attribs.src)
}
}
Expand Down Expand Up @@ -168,6 +169,7 @@ function isCssRule(rule: css.CssAtRuleAST): rule is css.CssRuleAST {
function makeProxyURL(url: string) {
if (!url) return url
if (url.startsWith('data:')) return url
url = url.trim()
return `/proxy?l=${encodeURIComponent(url)}`
}

Expand Down

0 comments on commit cb6c0dd

Please sign in to comment.