Skip to content

Commit

Permalink
🐛 fix: Avatar base64 src
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 authored Oct 11, 2023
1 parent 975d577 commit 2aed500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Avatar = memo<AvatarProps>(
const isImage = Boolean(
avatar && ['/', 'http', 'data:'].some((index) => avatar.startsWith(index)),
);
const isBase64 = Boolean (avatar.startsWith('data'));
const emoji = useMemo(() => avatar && !isImage && getEmoji(avatar), [avatar]);

const { styles, cx } = useStyles({ background, isEmoji: Boolean(emoji), size });
Expand All @@ -57,7 +58,8 @@ const Avatar = memo<AvatarProps>(
className={cx(styles.avatar, className)}
shape={shape}
size={size}
srcSet={avatar}
src={isBase64 ? avatar : undefined}
srcSet={isBase64 ? undefined : avatar}
{...props}
/>
) : (
Expand Down

0 comments on commit 2aed500

Please sign in to comment.