Commit 42289d4f authored by Travis Person's avatar Travis Person

Daemon panics if no path is given

If no path after `/ipfs/` or `/ipns/` is given, then the daemon will
panic with a slice bounds out of range error. This checks to see if we
have anything after `ipfs` or `ipns`.
parent 988b158d
......@@ -29,6 +29,10 @@ func Resolve(ctx context.Context, n *IpfsNode, p path.Path) (*merkledag.Node, er
}
seg := p.Segments()
if len(seg) < 2 {
return nil, errors.New("No path given")
}
extensions := seg[2:]
resolvable, err := path.FromSegments("/", seg[0], seg[1])
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment