From 4bba972de0def815aba3c43038c6c2f6894b92ae Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 11 Feb 2020 15:34:55 +0100 Subject: [PATCH] Fixed wrong escaping on legacy MachineLogger Fix #493 Fix https://github.com/arduino/Arduino/issues/9287 --- legacy/builder/i18n/i18n.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/legacy/builder/i18n/i18n.go b/legacy/builder/i18n/i18n.go index 3bb7f51ad7c..c40c6d45b18 100644 --- a/legacy/builder/i18n/i18n.go +++ b/legacy/builder/i18n/i18n.go @@ -20,7 +20,6 @@ import ( "io" "net/url" "os" - "reflect" "regexp" "strconv" "strings" @@ -209,9 +208,10 @@ func (s MachineLogger) UnformattedWrite(w io.Writer, data []byte) { func printMachineFormattedLogLine(w io.Writer, level string, format string, a []interface{}) { a = append([]interface{}(nil), a...) for idx, value := range a { - typeof := reflect.Indirect(reflect.ValueOf(value)).Kind() - if typeof == reflect.String { - a[idx] = url.QueryEscape(value.(string)) + if str, ok := value.(string); ok { + a[idx] = url.QueryEscape(str) + } else if stringer, ok := value.(fmt.Stringer); ok { + a[idx] = url.QueryEscape(stringer.String()) } } fprintf(w, "===%s ||| %s ||| %s\n", level, format, a)