@cryptotaxi247 / kubo / commits / 42289d4f2

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`.

Travis Person committed May 20, 2015 at 19:04 UTC 42289d4f21a9ec5408098a42f97ca9910ac9a9a6
1 file changed +4
core/pathresolver.go
+4
@@ -29,6 +29,10 @@ func Resolve(ctx context.Context, n *IpfsNode, p path.Path) (*merkledag.Node, er
29 }
30
31 seg := p.Segments()
32 + if len(seg) < 2 {
33 + return nil, errors.New("No path given")
34 + }
35 +
36 extensions := seg[2:]
37 resolvable, err := path.FromSegments("/", seg[0], seg[1])
38 if err != nil {