Skip to content

Commit

Permalink
fix: return an error when an unknown object type is passed
Browse files Browse the repository at this point in the history
fixes #7785
  • Loading branch information
Stebalien committed Dec 1, 2020
1 parent 1bf8a72 commit 95c49c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/coreapi/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (
n = new(dag.ProtoNode)
case "unixfs-dir":
n = ft.EmptyDirNode()
default:
return nil, fmt.Errorf("unknown node type: %s", options.Type)
}

err = api.dag.Add(ctx, n)
Expand Down

0 comments on commit 95c49c3

Please sign in to comment.