提交 74c4735b 作者: Łukasz Magiera

object put: allow empty objects

License: MIT
Signed-off-by: 's avatarŁukasz Magiera <magik6k@gmail.com>
上级 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 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论