Skip to content

Commit

Permalink
Only show https images in link preview
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Aug 28, 2023
1 parent 283b566 commit 198fdd0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/chats/ChatItem/LinkPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export default function LinkPreview({
length: 300,
})

const isValidImage = linkMetadata.image?.startsWith('https://')

return (
<div {...props} className={cx('w-full', props.className)}>
<div
Expand Down Expand Up @@ -67,7 +69,7 @@ export default function LinkPreview({
>
{truncatedDesc}
</p>
{linkMetadata.image && (
{linkMetadata.image && isValidImage && (
<MediaLoader
src={linkMetadata.image ?? ''}
alt=''
Expand Down

0 comments on commit 198fdd0

Please sign in to comment.