diff --git a/core/coreapi/object.go b/core/coreapi/object.go index 7cbd480c5..d10e13522 100644 --- a/core/coreapi/object.go +++ b/core/coreapi/object.go @@ -78,12 +78,6 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj return nil, err } - // check that we have data in the Node to add - // otherwise we will add the empty object without raising an error - if nodeEmpty(node) { - return nil, errors.New("no data or links in this node") - } - dagnode, err = deserializeNode(node, options.DataType) if err != nil { return nil, err @@ -99,12 +93,6 @@ func (api *ObjectAPI) Put(ctx context.Context, src io.Reader, opts ...caopts.Obj return nil, err } - // check that we have data in the Node to add - // otherwise we will add the empty object without raising an error - if nodeEmpty(node) { - return nil, errors.New("no data or links in this node") - } - dagnode, err = deserializeNode(node, options.DataType) if err != nil { return nil, err @@ -368,7 +356,3 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) return dagnode, nil } - -func nodeEmpty(node *Node) bool { - return node.Data == "" && len(node.Links) == 0 -}