diff --git a/src/sections/Community/Web-based-from/index.js b/src/sections/Community/Web-based-from/index.js index fad8155f86c0d..409c012b1731b 100644 --- a/src/sections/Community/Web-based-from/index.js +++ b/src/sections/Community/Web-based-from/index.js @@ -27,10 +27,22 @@ const validatePictureUrl = (value) => { } else { try { new URL(value); - const allowedImageExtensions = ["jpg", "jpeg", "png", "webp", "svg", "gif"]; - const extension = value.split(".").pop().toLowerCase(); - if (!allowedImageExtensions.includes(extension)) { - error = "URL must point to an image file (jpg, jpeg, png, svg, webp or gif)."; + + const isGoogleDrive = value.includes("drive.google.com"); + if (isGoogleDrive) { + const isFileLink = value.includes("/file/d/"); + const isViewLink = value.includes("/view"); + const isDownloadLink = value.includes("/uc?"); + + if (!isFileLink || (!isViewLink && !isDownloadLink)) { + error = "Please provide a direct Google Drive file link."; + } + } else { + const allowedImageExtensions = ["jpg", "jpeg", "png", "webp", "svg", "gif"]; + const extension = value.split(".").pop().toLowerCase(); + if (!allowedImageExtensions.includes(extension)) { + error = "URL must point to an image file (jpg, jpeg, png, svg, webp or gif)."; + } } } catch (err) { console.error("Error in validatePictureUrl:", err); @@ -185,7 +197,7 @@ const WebBasedForm = () => { {errors.picture && touched.picture &&
{errors.picture}
} -

Please provide a link to your profile photo. Profile photos are used for community member profiles of longstanding community members.

+

Please provide a link to your profile photo. Profile photos are used for community member profiles of longstanding community members. For Google Drive links, please ensure you're using direct image links that end with .jpg, .png, etc.