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
7a50636f
Commit
7a50636f
authored
Nov 30, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: return an error when an unknown object type is passed
fixes #7785
parent
1bf8a723
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
core/coreapi/object.go
core/coreapi/object.go
+2
-0
test/sharness/t0051-object.sh
test/sharness/t0051-object.sh
+4
-0
No files found.
core/coreapi/object.go
View file @
7a50636f
...
...
@@ -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
)
...
...
test/sharness/t0051-object.sh
View file @
7a50636f
...
...
@@ -223,6 +223,10 @@ test_object_cmd() {
ipfs object stat $OUTPUT
'
test_expect_success
"'ipfs object new foo' shouldn't crash"
'
test_expect_code 1 ipfs object new foo
'
test_expect_success
"'ipfs object links' gives the correct results"
'
echo "$EMPTY_DIR" 4 foo > expected &&
ipfs object links "$OUTPUT" > actual &&
...
...
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