⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Commit 47d97ca

Browse files
committed
fix: accept Google Drive links for profile picture in newcomers form
Signed-off-by: hudazaan <[email protected]>
1 parent aba1488 commit 47d97ca

File tree

1 file changed

+6
-8
lines changed
  • src/sections/Community/Web-based-from

1 file changed

+6
-8
lines changed

src/sections/Community/Web-based-from/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@ const validatePictureUrl = (value) => {
2929
new URL(value);
3030

3131
const isGoogleDrive = value.includes("drive.google.com");
32-
if (isGoogleDrive) {
33-
const isFileLink = value.includes("/file/d/");
34-
const isViewLink = value.includes("/view");
35-
const isDownloadLink = value.includes("/uc?");
32+
const validGoogleDrivePattern = /drive\.google\.com\/file\/d\/.+\/(view|uc\?)/;
3633

37-
if (!isFileLink || (!isViewLink && !isDownloadLink)) {
38-
error = "Please provide a direct Google Drive file link.";
34+
if (isGoogleDrive) {
35+
if (!validGoogleDrivePattern.test(value)) {
36+
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.";
3937
}
4038
} else {
4139
const allowedImageExtensions = ["jpg", "jpeg", "png", "webp", "svg", "gif"];
@@ -231,7 +229,7 @@ const WebBasedForm = () => {
231229
setRole("User");
232230
}}
233231
>
234-
I'm here as a User and Contibutor
232+
I'm here as a User and Contributor
235233
</div>
236234
<div className={role === "Bystander" ? "option active" : "option"} onClick={() => {
237235
setRole("Bystander");
@@ -242,7 +240,7 @@ const WebBasedForm = () => {
242240
<br /><br />
243241
<div className="btn-wrapper">
244242
<button onClick={laststep} className="btn-prev"><span className="back">&larr;</span> Previous Step</button>
245-
<Button onClick={() => setStepNumber(2)}$secondary type="submit" className="btn-next" title="Next Step" />
243+
<Button onClick={() => setStepNumber(2)} $secondary type="submit" className="btn-next" title="Next Step" />
246244
</div>
247245
</div>
248246

0 commit comments

Comments
 (0)