mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 01:12:24 +08:00
fix dht command key escaping
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
@ -354,6 +354,8 @@ GetValue will return the value stored in the DHT at the given key.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Error("RESOLVE KEY: ", []byte(dhtkey))
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(outChan)
|
defer close(outChan)
|
||||||
for e := range events {
|
for e := range events {
|
||||||
@ -573,7 +575,7 @@ func escapeDhtKey(s string) (key.Key, error) {
|
|||||||
return key.B58KeyDecode(s), nil
|
return key.B58KeyDecode(s), nil
|
||||||
case 3:
|
case 3:
|
||||||
k := key.B58KeyDecode(parts[2])
|
k := key.B58KeyDecode(parts[2])
|
||||||
return key.Key(path.Join(append(parts[:2], k.String()))), nil
|
return key.Key(path.Join(append(parts[:2], string(k)))), nil
|
||||||
default:
|
default:
|
||||||
return "", errors.New("invalid key")
|
return "", errors.New("invalid key")
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ func PutRecordToRouting(ctx context.Context, k ci.PrivKey, value path.Path, seqn
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Error("KEY: ", []byte(namekey))
|
||||||
ttl, ok := checkCtxTTL(ctx)
|
ttl, ok := checkCtxTTL(ctx)
|
||||||
if ok {
|
if ok {
|
||||||
entry.Ttl = proto.Uint64(uint64(ttl.Nanoseconds()))
|
entry.Ttl = proto.Uint64(uint64(ttl.Nanoseconds()))
|
||||||
|
Reference in New Issue
Block a user