Skip to content

Commit

Permalink
🐛 fix: Fix XSS (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Jul 18, 2024
1 parent 676d38c commit 4ea87cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Highlighter/SyntaxHighlighter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SyntaxHighlighter = memo<SyntaxHighlighterProps>(

return (
<>
{isLoading ? (
{isLoading || !data ? (
<div className={cx(styles.unshiki, className)} style={style}>
<pre>
<code>{children.trim()}</code>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const useHighlight = (text: string, lang: string, isDarkMode: boolean) =>
});
return html;
} catch {
return `<pre><code>${text}</code></pre>`;
return '';
}
},
{ revalidateOnFocus: false },
Expand Down

0 comments on commit 4ea87cf

Please sign in to comment.