File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ func MustParse(fqbnIn string) *FQBN {
4242 return res
4343}
4444
45+ var fqbnValidationRegex = regexp .MustCompile (`^[a-zA-Z0-9_.-]*$` )
46+ var valueValidationRegex = regexp .MustCompile (`^[a-zA-Z0-9=_.-]*$` )
47+
4548// Parse parses an FQBN string from the input string
4649func Parse (fqbnIn string ) (* FQBN , error ) {
4750 // Split fqbn parts
@@ -60,7 +63,6 @@ func Parse(fqbnIn string) (*FQBN, error) {
6063 return nil , errors .New (i18n .Tr ("empty board identifier" ))
6164 }
6265 // Check if the fqbn contains invalid characters
63- fqbnValidationRegex := regexp .MustCompile (`^[a-zA-Z0-9_.-]*$` )
6466 for i := 0 ; i < 3 ; i ++ {
6567 if ! fqbnValidationRegex .MatchString (fqbnParts [i ]) {
6668 return nil , errors .New (i18n .Tr ("fqbn's field %s contains an invalid character" , fqbnParts [i ]))
@@ -81,7 +83,6 @@ func Parse(fqbnIn string) (*FQBN, error) {
8183 return nil , errors .New (i18n .Tr ("config key %s contains an invalid character" , k ))
8284 }
8385 // The config value can also contain the = symbol
84- valueValidationRegex := regexp .MustCompile (`^[a-zA-Z0-9=_.-]*$` )
8586 if ! valueValidationRegex .MatchString (v ) {
8687 return nil , errors .New (i18n .Tr ("config value %s contains an invalid character" , v ))
8788 }
You can’t perform that action at this time.
0 commit comments