From f6b00759896c068a4e28865340c723a977778ffa Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 21 Dec 2018 10:04:32 +0000 Subject: [PATCH] Case-insensitive checking of null if string, don't print the nodeinfo again --- src/yggdrasil/nodeinfo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yggdrasil/nodeinfo.go b/src/yggdrasil/nodeinfo.go index 89a90a21..b9076328 100644 --- a/src/yggdrasil/nodeinfo.go +++ b/src/yggdrasil/nodeinfo.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "runtime" + "strings" "sync" "time" @@ -114,7 +115,7 @@ func (m *nodeinfo) setNodeInfo(given interface{}, privacy bool) error { if nodeinfomap, ok := given.(map[string]interface{}); ok { for key, value := range nodeinfomap { if _, ok := defaults[key]; ok { - if strvalue, strok := value.(string); strok && strvalue == "null" || value == nil { + if strvalue, strok := value.(string); strok && strings.EqualFold(strvalue, "null") || value == nil { delete(newnodeinfo, key) } continue @@ -123,7 +124,6 @@ func (m *nodeinfo) setNodeInfo(given interface{}, privacy bool) error { } } if newjson, err := json.Marshal(newnodeinfo); err == nil { - m.core.log.Println(string(newjson)) if len(newjson) > 16384 { return errors.New("NodeInfo exceeds max length of 16384 bytes") }