@cryptotaxi247 / kubo / commits / ea0926804

commands/http: 404 when trying to call root command

Matt Bell committed Oct 30, 2014 at 21:55 UTC ea09268044841048137b09199ca4c50ed7a0b74c
1 file changed +4
commands/http/parse.go
+4
@@ -18,6 +18,10 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
18 return nil, ErrNotFound
19
20 } else if sub := cmd.Subcommand(path[len(path)-1]); sub == nil {
21 + if len(path) <= 1 {
22 + return nil, ErrNotFound
23 + }
24 +
25 // if the last string in the path isn't a subcommand, use it as an argument
26 // e.g. /objects/Qabc12345 (we are passing "Qabc12345" to the "objects" command)
27 args = append(args, path[len(path)-1])