1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-26 07:28:20 +08:00

ipfs name resolve --local fixed multihash error

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

Fixes #2527

License: MIT
Signed-off-by: Mike Pfister <pfista@gmail.com>
This commit is contained in:
Michael Pfister
2016-04-18 13:32:03 -07:00
parent 2509631c29
commit 437d6b6585

View File

@ -2,6 +2,7 @@ package namesys
import (
"fmt"
"strings"
"time"
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
return cached, nil
}
name = strings.TrimPrefix(name, "/ipns/")
hash, err := mh.FromB58String(name)
if err != nil {
// name should be a multihash. if it isn't, error out here.