Skip to content

Commit

Permalink
Merge pull request #4053 from Quantomicus/bugfix
Browse files Browse the repository at this point in the history
Fixes #4003
  • Loading branch information
whyrusleeping authored Jul 23, 2017
2 parents 2f260ca + 48dcd67 commit 181dd00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/coreunix/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ func (adder *Adder) Finalize() (node.Node, error) {
if err != nil {
return nil, err
}

if len(children) == 0 {
return nil, fmt.Errorf("expected at least one child dir, got none")
}

name = children[0]

mr, err := adder.mfsRoot()
Expand Down
5 changes: 5 additions & 0 deletions test/sharness/t0600-issues-and-regressions-online.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ test_expect_success "pin add api looks right - #3753" '
test_cmp pinrm_out pinrm_exp
'

test_expect_success "no daemon crash on improper file argument - #4003" '
FNC=$(echo $API_ADDR | awk -F: '\''{ printf "%s %s", $1, $2 }'\'') &&
echo -n "POST /api/v0/add?pin=true HTTP/1.1\r\nHost: $API_ADDR\r\nContent-Type: multipart/form-data; boundary=Pyw9xQLtiLPE6XcI\r\nContent-Length: 22\r\n\r\n\r\n--Pyw9xQLtiLPE6XcI\r\n" | nc -v $FNC | grep "200 OK"
'

test_kill_ipfs_daemon

test_expect_success "ipfs daemon --offline --mount fails - #2995" '
Expand Down

0 comments on commit 181dd00

Please sign in to comment.