Commit 74c4735b authored by Łukasz Magiera's avatar Łukasz Magiera

object put: allow empty objects

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 7e9eb72b
......@@ -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
}
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