Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
74c4735b
Commit
74c4735b
authored
May 14, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
object put: allow empty objects
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
7e9eb72b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
16 deletions
+0
-16
core/coreapi/object.go
core/coreapi/object.go
+0
-16
No files found.
core/coreapi/object.go
View file @
74c4735b
...
...
@@ -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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment