From b9f3d3d484f416e26fe383640de2c4e4d56259b9 Mon Sep 17 00:00:00 2001 From: okanzdmr Date: Fri, 12 Aug 2022 00:49:55 +0300 Subject: [PATCH] fix: regex for different formats --- .../extension-onboarding/src/components/NFTItem/NFTItem.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/extension-onboarding/src/components/NFTItem/NFTItem.tsx b/packages/extension-onboarding/src/components/NFTItem/NFTItem.tsx index de801f8ca2..41fa436cc6 100644 --- a/packages/extension-onboarding/src/components/NFTItem/NFTItem.tsx +++ b/packages/extension-onboarding/src/components/NFTItem/NFTItem.tsx @@ -11,9 +11,8 @@ const NFTItem: FC = ({ item }: INFTItemProps) => { const classes = useStyles(); const nftImages = useMemo((): string[] => { - const regexpImage = /(\"image.*?\":\s*?\"(\s*?.*?\s*?)\")/; - const regexpUrl = - /(https?|ipfs):\/\/([-A-Z0-9.]+)(\/[-A-Z0-9+&@#\/%=~_|!:,.;]*)/i; + const regexpImage = /(\"image.*?\":.*?\"(.*?)\\?\")/; + const regexpUrl = /(https?|ipfs)/i; const splittedData = item.metadata?.split(regexpImage); const extractedImages: string[] = []; splittedData?.forEach((key) => {