diff --git a/core/pathresolver_test.go b/core/pathresolver_test.go index 489af4eb5..9db0bfbeb 100644 --- a/core/pathresolver_test.go +++ b/core/pathresolver_test.go @@ -24,4 +24,8 @@ func TestResolveNoComponents(t *testing.T) { t.Fatal("Should error with no components (/ipfs/).", err) } + _, err = core.Resolve(n.Context(), n, path.Path("/../..")) + if err != path.ErrBadPath { + t.Fatal("Should error with invalid path.", err) + } } diff --git a/test/sharness/t0090-get.sh b/test/sharness/t0090-get.sh index 393ba5b5b..4f9c4b581 100755 --- a/test/sharness/t0090-get.sh +++ b/test/sharness/t0090-get.sh @@ -112,6 +112,12 @@ test_get_cmd() { test_cmp dir/b/c "$HASH2"/b/c && rm -r "$HASH2" ' + + test_expect_success "ipfs get ../.. should fail" ' + echo "Error: invalid ipfs ref path" >expected && + test_must_fail ipfs get ../.. 2>actual && + test_cmp expected actual + ' } # should work offline