From c1560befcd509d5d96d5fa65902ed36cc5d9e2a3 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 22 Apr 2015 23:20:22 -0700 Subject: [PATCH] fix up core.Resolve a bit --- core/commands/publish.go | 8 +++----- path/path.go | 6 +++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/commands/publish.go b/core/commands/publish.go index bef930bd9..388a72f82 100644 --- a/core/commands/publish.go +++ b/core/commands/publish.go @@ -8,7 +8,6 @@ import ( cmds "github.com/ipfs/go-ipfs/commands" core "github.com/ipfs/go-ipfs/core" - nsys "github.com/ipfs/go-ipfs/namesys" crypto "github.com/ipfs/go-ipfs/p2p/crypto" path "github.com/ipfs/go-ipfs/path" u "github.com/ipfs/go-ipfs/util" @@ -77,6 +76,7 @@ Publish an to another public key (not implemented): // name = args[0] pstr = args[1] res.SetError(errors.New("keychains not yet implemented"), cmds.ErrNormal) + return case 1: // name = n.Identity.ID.String() pstr = args[0] @@ -108,14 +108,12 @@ Publish an to another public key (not implemented): func publish(n *core.IpfsNode, k crypto.PrivKey, ref path.Path) (*IpnsEntry, error) { // First, verify the path exists - _, err := n.Resolver.ResolvePath(ref) + _, err := core.Resolve(n, ref) if err != nil { return nil, err } - pub := nsys.NewRoutingPublisher(n.Routing) - - err = pub.Publish(n.Context(), k, ref) + err = n.Namesys.Publish(n.Context(), k, ref) if err != nil { return nil, err } diff --git a/path/path.go b/path/path.go index e61a06193..15c1b4591 100644 --- a/path/path.go +++ b/path/path.go @@ -45,7 +45,11 @@ func (p Path) String() string { } func FromSegments(seg ...string) Path { - return Path(strings.Join(seg, "/")) + var pref string + if seg[0] == "ipfs" || seg[0] == "ipns" { + pref = "/" + } + return Path(pref + strings.Join(seg, "/")) } func ParsePath(txt string) (Path, error) {