From 9027eaa426a42ac8e9a73c85f5fee5df84af71df Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 30 Apr 2019 00:59:00 -0700 Subject: [PATCH] commands(dht): base64 encode value in get Otherwise, it seems that something is treating this as UTF8 and normalizing it? fix half of #3124 License: MIT Signed-off-by: Steven Allen --- core/commands/dht.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/commands/dht.go b/core/commands/dht.go index 89799555f..03f19ec4a 100644 --- a/core/commands/dht.go +++ b/core/commands/dht.go @@ -2,6 +2,7 @@ package commands import ( "context" + "encoding/base64" "errors" "fmt" "io" @@ -469,7 +470,7 @@ Different key types can specify other 'best' rules. } else { notif.PublishQueryEvent(ctx, ¬if.QueryEvent{ Type: notif.Value, - Extra: string(val), + Extra: base64.StdEncoding.EncodeToString(val), }) } }() @@ -489,7 +490,11 @@ Different key types can specify other 'best' rules. if verbose { fmt.Fprintf(out, "got value: '%s'\n", obj.Extra) } else { - fmt.Fprintln(out, obj.Extra) + res, err := base64.StdEncoding.DecodeString(obj.Extra) + if err != nil { + return err + } + out.Write(res) } return nil },