From 863640f70dfe185343a1c3e0417ccd7fae10fe89 Mon Sep 17 00:00:00 2001 From: Ludovic Levalleux Date: Thu, 4 Jan 2024 16:45:11 +0000 Subject: [PATCH] fix: ensure the LENS profile/cover images have a type, as it is verified by ProductType form values validation (#984) --- .../modal/components/Profile/utils.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/modal/components/Profile/utils.ts b/src/components/modal/components/Profile/utils.ts index 30bc52ce4..e76a00b2f 100644 --- a/src/components/modal/components/Profile/utils.ts +++ b/src/components/modal/components/Profile/utils.ts @@ -30,12 +30,26 @@ export function buildProfileFromMetadata( (img) => img.tag === "cover" ); const isLens = useLens && lensProfile; - const lensCoverPicture = isLens - ? { url: getLensCoverPictureUrl(lensProfile), type: "" } // type is not necessary - : null; - const lensProfileImage = isLens - ? { url: getLensProfilePictureUrl(lensProfile), type: "" } - : null; + let lensCoverPicture = null, + lensProfileImage = null; + if (isLens) { + const lensCoverPictureUrl = getLensCoverPictureUrl(lensProfile); + const lensCoverPictureType = lensCoverPictureUrl + ? "image/" + lensCoverPictureUrl.split(".").pop() + : ""; + lensCoverPicture = { + url: lensCoverPictureUrl, + type: lensCoverPictureType + }; + const lensProfileImageUrl = getLensProfilePictureUrl(lensProfile); + const lensProfileImageType = lensProfileImageUrl + ? "image/" + lensProfileImageUrl.split(".").pop() + : ""; + lensProfileImage = { + url: lensProfileImageUrl, + type: lensProfileImageType + }; + } const coverPicture = lensCoverPicture || regularCoverPicture; const profileImage = lensProfileImage || regularProfileImage; const email = isLens