Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
decode HTML before render
  • Loading branch information
jennspencer committed Jun 14, 2024
commit 30693a7a172e5296e169aadb646f59901fa15e7e
3 changes: 2 additions & 1 deletion components/Embed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Embed = ({
}: EmbedProps) => {
if (typeof iframe !== 'boolean') iframe = iframe === 'true';
if (html === 'false') html = undefined;
if (html) html = decodeURIComponent(html);

if (iframe) {
return <iframe {...attrs} src={url} style={{ border: 'none', display: 'flex', margin: 'auto' }} />;
Expand All @@ -54,7 +55,7 @@ const Embed = ({
return (
<div className={classes.join(' ')}>
{html ? (
<div className="embed-media" dangerouslySetInnerHTML={{ __html: decodeURIComponent(html) }} />
<div className="embed-media" dangerouslySetInnerHTML={{ __html: html }} />
) : (
<a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
{!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : undefined} src={image} />}
Expand Down