@@ -27,10 +27,19 @@ const validatePictureUrl = (value) => {
2727 } else {
2828 try {
2929 new URL ( value ) ;
30- const allowedImageExtensions = [ "jpg" , "jpeg" , "png" , "webp" , "svg" , "gif" ] ;
31- const extension = value . split ( "." ) . pop ( ) . toLowerCase ( ) ;
32- if ( ! allowedImageExtensions . includes ( extension ) ) {
33- error = "URL must point to an image file (jpg, jpeg, png, svg, webp or gif)." ;
30+ const isGoogleDrive = value . includes ( "drive.google.com" ) ;
31+ const validGoogleDrivePattern = / d r i v e \. g o o g l e \. c o m \/ f i l e \/ d \/ .+ \/ ( v i e w | u c \? ) / ;
32+
33+ if ( isGoogleDrive ) {
34+ if ( ! validGoogleDrivePattern . test ( value ) ) {
35+ 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." ;
36+ }
37+ } else {
38+ const allowedImageExtensions = [ "jpg" , "jpeg" , "png" , "webp" , "svg" , "gif" ] ;
39+ const extension = value . split ( "." ) . pop ( ) . toLowerCase ( ) ;
40+ if ( ! allowedImageExtensions . includes ( extension ) ) {
41+ error = "URL must point to an image file (jpg, jpeg, png, svg, webp or gif)." ;
42+ }
3443 }
3544 } catch ( err ) {
3645 console . error ( "Error in validatePictureUrl:" , err ) ;
@@ -219,7 +228,7 @@ const WebBasedForm = () => {
219228 setRole ( "User" ) ;
220229 } }
221230 >
222- I'm here as a User and Contibutor
231+ I'm here as a User and Contributor
223232 </ div >
224233 < div className = { role === "Bystander" ? "option active" : "option" } onClick = { ( ) => {
225234 setRole ( "Bystander" ) ;
@@ -230,7 +239,7 @@ const WebBasedForm = () => {
230239 < br /> < br />
231240 < div className = "btn-wrapper" >
232241 < button onClick = { laststep } className = "btn-prev" > < span className = "back" > ←</ span > Previous Step</ button >
233- < Button onClick = { ( ) => setStepNumber ( 2 ) } $secondary type = "submit" className = "btn-next" title = "Next Step" />
242+ < Button onClick = { ( ) => setStepNumber ( 2 ) } $secondary type = "submit" className = "btn-next" title = "Next Step" />
234243 </ div >
235244 </ div >
236245
0 commit comments