@@ -50,8 +50,11 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error
5050 if publiccodev0 .Logo != "" {
5151 if _ , err := isRelativePathOrURL (publiccodev0 .Logo , "logo" ); err != nil {
5252 vr = append (vr , err )
53- } else if validLogo , err := parser .validLogo (toCodeHostingURL (publiccodev0 .Logo , parser .currentBaseURL ), network ); ! validLogo {
54- vr = append (vr , newValidationError ("logo" , err .Error ()))
53+ } else if ! parser .disableExternalChecks {
54+ validLogo , err := parser .validLogo (toCodeHostingURL (publiccodev0 .Logo , parser .currentBaseURL ), network )
55+ if ! validLogo {
56+ vr = append (vr , newValidationError ("logo" , err .Error ()))
57+ }
5558 }
5659 }
5760
@@ -60,8 +63,11 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error
6063
6164 if _ , err := isRelativePathOrURL (publiccodev0 .MonochromeLogo , "monochromeLogo" ); err != nil {
6265 vr = append (vr , err )
63- } else if validLogo , err := parser .validLogo (toCodeHostingURL (publiccodev0 .MonochromeLogo , parser .currentBaseURL ), network ); ! validLogo {
64- vr = append (vr , newValidationError ("monochromeLogo" , err .Error ()))
66+ } else if ! parser .disableExternalChecks {
67+ validLogo , err := parser .validLogo (toCodeHostingURL (publiccodev0 .MonochromeLogo , parser .currentBaseURL ), network )
68+ if ! validLogo {
69+ vr = append (vr , newValidationError ("monochromeLogo" , err .Error ()))
70+ }
6571 }
6672 }
6773
@@ -70,10 +76,13 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error
7076
7177 if _ , err := isRelativePathOrURL (* publiccodev0 .Legal .AuthorsFile , "legal.authorsFile" ); err != nil {
7278 vr = append (vr , err )
73- } else if exists , err := parser .fileExists (toCodeHostingURL (* publiccodev0 .Legal .AuthorsFile , parser .currentBaseURL ), network ); ! exists {
74- u := toCodeHostingURL (* publiccodev0 .Legal .AuthorsFile , parser .currentBaseURL )
79+ } else if ! parser .disableExternalChecks {
80+ exists , err := parser .fileExists (toCodeHostingURL (* publiccodev0 .Legal .AuthorsFile , parser .currentBaseURL ), network )
81+ if ! exists {
82+ u := toCodeHostingURL (* publiccodev0 .Legal .AuthorsFile , parser .currentBaseURL )
7583
76- vr = append (vr , newValidationError ("legal.authorsFile" , "'%s' does not exist: %s" , urlutil .DisplayURL (& u ), err .Error ()))
84+ vr = append (vr , newValidationError ("legal.authorsFile" , "'%s' does not exist: %s" , urlutil .DisplayURL (& u ), err .Error ()))
85+ }
7786 }
7887 }
7988
@@ -119,11 +128,14 @@ func validateFieldsV0(publiccode PublicCode, parser Parser, network bool) error
119128 keyName := fmt .Sprintf ("description.%s.screenshots[%d]" , lang , i )
120129 if _ , err := isRelativePathOrURL (v , keyName ); err != nil {
121130 vr = append (vr , err )
122- } else if isImage , err := parser .isImageFile (toCodeHostingURL (v , parser .currentBaseURL ), network ); ! isImage {
123- vr = append (vr , newValidationError (
124- keyName ,
125- "'%s' is not an image: %s" , v , err .Error (),
126- ))
131+ } else if ! parser .disableExternalChecks {
132+ isImage , err := parser .isImageFile (toCodeHostingURL (v , parser .currentBaseURL ), network )
133+ if ! isImage {
134+ vr = append (vr , newValidationError (
135+ keyName ,
136+ "'%s' is not an image: %s" , v , err .Error (),
137+ ))
138+ }
127139 }
128140 }
129141
0 commit comments