File tree 1 file changed +3
-2
lines changed
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 {
42
42
return res
43
43
}
44
44
45
+ var fqbnValidationRegex = regexp .MustCompile (`^[a-zA-Z0-9_.-]*$` )
46
+ var valueValidationRegex = regexp .MustCompile (`^[a-zA-Z0-9=_.-]*$` )
47
+
45
48
// Parse parses an FQBN string from the input string
46
49
func Parse (fqbnIn string ) (* FQBN , error ) {
47
50
// Split fqbn parts
@@ -60,7 +63,6 @@ func Parse(fqbnIn string) (*FQBN, error) {
60
63
return nil , errors .New (i18n .Tr ("empty board identifier" ))
61
64
}
62
65
// Check if the fqbn contains invalid characters
63
- fqbnValidationRegex := regexp .MustCompile (`^[a-zA-Z0-9_.-]*$` )
64
66
for i := 0 ; i < 3 ; i ++ {
65
67
if ! fqbnValidationRegex .MatchString (fqbnParts [i ]) {
66
68
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) {
81
83
return nil , errors .New (i18n .Tr ("config key %s contains an invalid character" , k ))
82
84
}
83
85
// The config value can also contain the = symbol
84
- valueValidationRegex := regexp .MustCompile (`^[a-zA-Z0-9=_.-]*$` )
85
86
if ! valueValidationRegex .MatchString (v ) {
86
87
return nil , errors .New (i18n .Tr ("config value %s contains an invalid character" , v ))
87
88
}
You can’t perform that action at this time.
0 commit comments