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 <steven@stebalien.com>
Steven Allen committed
Apr 30, 2019 at 00:59 UTC
9027eaa426a42ac8e9a73c85f5fee5df84af71df
1 file changed
+7
-2
core/commands/dht.go
+7
-2
@@ -2,6 +2,7 @@ package commands
2
3
import (
4
"context"
5
+ "encoding/base64"
6
"errors"
7
"fmt"
8
"io"
@@ -469,7 +470,7 @@ Different key types can specify other 'best' rules.
470
} else {
471
notif.PublishQueryEvent(ctx, ¬if.QueryEvent{
472
Type: notif.Value,
472
- Extra: string(val),
473
+ Extra: base64.StdEncoding.EncodeToString(val),
474
})
475
}
476
}()
@@ -489,7 +490,11 @@ Different key types can specify other 'best' rules.
490
if verbose {
491
fmt.Fprintf(out, "got value: '%s'\n", obj.Extra)
492
} else {
492
- fmt.Fprintln(out, obj.Extra)
493
+ res, err := base64.StdEncoding.DecodeString(obj.Extra)
494
+ if err != nil {
495
+ return err
496
+ }
497
+ out.Write(res)
498
}
499
return nil
500
},