Better exception handling for getDomain

This commit is contained in:
Fedor Indutny 2024-09-09 14:00:21 -07:00 committed by GitHub
parent 9efb046a06
commit 319890d138
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 9 deletions

View file

@ -43,7 +43,11 @@ import type {
} from '../../components/conversation/GroupNotification';
import type { PropsType as ProfileChangeNotificationPropsType } from '../../components/conversation/ProfileChangeNotification';
import { getDomain, isCallLink, isStickerPack } from '../../types/LinkPreview';
import {
getSafeDomain,
isCallLink,
isStickerPack,
} from '../../types/LinkPreview';
import type {
AciString,
PniString,
@ -390,7 +394,7 @@ const getPreviewsForMessage = ({
...preview,
isStickerPack: isStickerPack(preview.url),
isCallLink: isCallLink(preview.url),
domain: getDomain(preview.url),
domain: getSafeDomain(preview.url),
image: preview.image ? getPropsForAttachment(preview.image) : undefined,
}));
};