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>
This commit is contained in:
Steven Allen 2019-04-30 00:59:00 -07:00
parent 76dc6f5662
commit 9027eaa426

View File

@ -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, &notif.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
},