Skip to content

Commit

Permalink
fix opther tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Aug 21, 2023
1 parent 5257627 commit 5a6a27b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
4 changes: 2 additions & 2 deletions core/commands/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ It will work across multiple DNSLinks and IPNS keys.
if err != nil && (recursive || err != namesys.ErrResolveRecursion) {
return err
}
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: output})
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: output.String()})
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ncmd.ResolvedPath) error {
fmt.Fprintln(w, cmdenv.EscNonPrint(out.Path.String()))
fmt.Fprintln(w, cmdenv.EscNonPrint(out.Path))
return nil
}),
},
Expand Down
6 changes: 3 additions & 3 deletions core/commands/name/ipns.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
var log = logging.Logger("core/commands/ipns")

type ResolvedPath struct {
Path path.Path
Path string
}

const (
Expand Down Expand Up @@ -139,7 +139,7 @@ Resolve the value of a dnslink:
return err
}

return cmds.EmitOnce(res, &ResolvedPath{pth})
return cmds.EmitOnce(res, &ResolvedPath{pth.String()})
}

output, err := api.Name().Search(req.Context, name, opts...)
Expand All @@ -151,7 +151,7 @@ Resolve the value of a dnslink:
if v.Err != nil && (recursive || v.Err != namesys.ErrResolveRecursion) {
return v.Err
}
if err := res.Emit(&ResolvedPath{v.Path}); err != nil {
if err := res.Emit(&ResolvedPath{v.Path.String()}); err != nil {
return err
}

Expand Down
9 changes: 4 additions & 5 deletions core/commands/name/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/ipfs/boxo/ipns"
ipns_pb "github.com/ipfs/boxo/ipns/pb"
"github.com/ipfs/boxo/path"
cmds "github.com/ipfs/go-ipfs-cmds"
cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -87,7 +86,7 @@ type IpnsInspectValidation struct {
// IpnsInspectEntry contains the deserialized values from an IPNS Entry:
// https://github.com/ipfs/specs/blob/main/ipns/IPNS.md#record-serialization-format
type IpnsInspectEntry struct {
Value path.Path
Value string
ValidityType *ipns.ValidityType
Validity *time.Time
Sequence *uint64
Expand Down Expand Up @@ -157,7 +156,7 @@ Passing --verify will verify signature against provided public key.

// Best effort to get the fields. Show everything we can.
if v, err := rec.Value(); err == nil {
result.Entry.Value = v
result.Entry.Value = v.String()
}

if v, err := rec.ValidityType(); err == nil {
Expand Down Expand Up @@ -221,8 +220,8 @@ Passing --verify will verify signature against provided public key.
tw := tabwriter.NewWriter(w, 0, 0, 1, ' ', 0)
defer tw.Flush()

if out.Entry.Value != nil {
fmt.Fprintf(tw, "Value:\t%q\n", out.Entry.Value.String())
if out.Entry.Value != "" {
fmt.Fprintf(tw, "Value:\t%q\n", out.Entry.Value)
}

if out.Entry.ValidityType != nil {
Expand Down
12 changes: 3 additions & 9 deletions core/commands/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

ns "github.com/ipfs/boxo/namesys"
"github.com/ipfs/boxo/path"
cidenc "github.com/ipfs/go-cidutil/cidenc"
cmdenv "github.com/ipfs/kubo/core/commands/cmdenv"
"github.com/ipfs/kubo/core/commands/cmdutils"
Expand Down Expand Up @@ -108,7 +107,7 @@ Resolve the value of an IPFS DAG path:
if err != nil && err != ns.ErrResolveRecursion {
return err
}
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: p})
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: p.String()})
}

var enc cidenc.Encoder
Expand Down Expand Up @@ -144,16 +143,11 @@ Resolve the value of an IPFS DAG path:
encoded += "/" + remainder
}

rpe, err := path.NewPath(encoded)
if err != nil {
return err
}

return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: rpe})
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: encoded})
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, rp *ncmd.ResolvedPath) error {
fmt.Fprintln(w, rp.Path.String())
fmt.Fprintln(w, rp.Path)
return nil
}),
},
Expand Down
3 changes: 1 addition & 2 deletions core/coreapi/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package coreapi
import (
"context"
"errors"
"path"
"strings"

coreiface "github.com/ipfs/boxo/coreiface"
Expand Down Expand Up @@ -57,5 +56,5 @@ func normalizeKey(s string) (string, error) {
if err != nil {
return "", err
}
return path.Join(append(parts[:2], string(k))...), nil
return strings.Join(append(parts[:2], string(k)), "/"), nil
}

0 comments on commit 5a6a27b

Please sign in to comment.