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 authored and hacdias committed Nov 9, 2023
1 parent 7834a26 commit 670ce70
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
}

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

0 comments on commit 670ce70

Please sign in to comment.