Skip to content

Commit 4bba972

Browse files
committed
Fixed wrong escaping on legacy MachineLogger
Fix arduino#493 Fix arduino/Arduino#9287
1 parent 469b339 commit 4bba972

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: legacy/builder/i18n/i18n.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"io"
2121
"net/url"
2222
"os"
23-
"reflect"
2423
"regexp"
2524
"strconv"
2625
"strings"
@@ -209,9 +208,10 @@ func (s MachineLogger) UnformattedWrite(w io.Writer, data []byte) {
209208
func printMachineFormattedLogLine(w io.Writer, level string, format string, a []interface{}) {
210209
a = append([]interface{}(nil), a...)
211210
for idx, value := range a {
212-
typeof := reflect.Indirect(reflect.ValueOf(value)).Kind()
213-
if typeof == reflect.String {
214-
a[idx] = url.QueryEscape(value.(string))
211+
if str, ok := value.(string); ok {
212+
a[idx] = url.QueryEscape(str)
213+
} else if stringer, ok := value.(fmt.Stringer); ok {
214+
a[idx] = url.QueryEscape(stringer.String())
215215
}
216216
}
217217
fprintf(w, "===%s ||| %s ||| %s\n", level, format, a)

0 commit comments

Comments
 (0)