提交 437d6b65 作者: Michael Pfister

ipfs name resolve --local fixed multihash error

resolveOnce should remove '/ipns/' prefix before using multihash functions.

Fixes #2527

License: MIT
Signed-off-by: 's avatarMike Pfister <pfista@gmail.com>
上级 2509631c
...@@ -2,6 +2,7 @@ package namesys ...@@ -2,6 +2,7 @@ package namesys
import ( import (
"fmt" "fmt"
"strings"
"time" "time"
lru "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/hashicorp/golang-lru" lru "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/hashicorp/golang-lru"
...@@ -122,6 +123,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa ...@@ -122,6 +123,7 @@ func (r *routingResolver) resolveOnce(ctx context.Context, name string) (path.Pa
return cached, nil return cached, nil
} }
name = strings.TrimPrefix(name, "/ipns/")
hash, err := mh.FromB58String(name) hash, err := mh.FromB58String(name)
if err != nil { if err != nil {
// name should be a multihash. if it isn't, error out here. // name should be a multihash. if it isn't, error out here.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论