Skip to content

Commit

Permalink
fix: regression in 'ipfs dns'
Browse files Browse the repository at this point in the history
this command used to work with domain without `/ipns/` prefix.

we've switched it to the same backend as `resolve` command,
which requires the prefix, so we add it if it is missing
  • Loading branch information
lidel committed Nov 8, 2023
1 parent 9655d92 commit 2effc26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/commands/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"fmt"
"io"
"strings"

namesys "github.com/ipfs/boxo/namesys"
"github.com/ipfs/boxo/path"
Expand All @@ -19,7 +20,7 @@ const (
var DNSCmd = &cmds.Command{
Status: cmds.Deprecated, // https://github.com/ipfs/kubo/issues/8607
Helptext: cmds.HelpText{
Tagline: "Resolve DNSLink records.",
Tagline: "Resolve DNSLink records. Deprecated: Use 'ipfs resolve /ipns/domain-name' instead.",
ShortDescription: `
This command can only recursively resolve DNSLink TXT records.
It will fail to recursively resolve through IPNS keys etc.
Expand Down Expand Up @@ -52,6 +53,10 @@ It will work across multiple DNSLinks and IPNS keys.
routing = append(routing, namesys.ResolveWithDepth(1))
}

if !strings.HasPrefix(name, "/ipns/") {
name = "/ipns/" + name
}

Check warning on line 58 in core/commands/dns.go

View check run for this annotation

Codecov / codecov/patch

core/commands/dns.go#L56-L58

Added lines #L56 - L58 were not covered by tests

p, err := path.NewPath(name)
if err != nil {
return err
Expand Down

0 comments on commit 2effc26

Please sign in to comment.