diff --git a/src/sections/Community/Web-based-from/index.js b/src/sections/Community/Web-based-from/index.js index fad8155f86c0d..7172a27223ceb 100644 --- a/src/sections/Community/Web-based-from/index.js +++ b/src/sections/Community/Web-based-from/index.js @@ -27,10 +27,20 @@ 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"); + const validGoogleDrivePattern = /drive\.google\.com\/file\/d\/.+\/(view|uc\?)/; + + if (isGoogleDrive) { + if (!validGoogleDrivePattern.test(value)) { + error = "Please provide a direct Google Drive file link. Right-click the file in Google Drive and select 'Get link' to get a shareable link that includes '/file/d/' in the URL."; + } + } 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 +195,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.

-