@cryptotaxi247 / kubo / commits / 44245fe01

Add test to detect invalid path

License: MIT Signed-off-by: rht <rhtbot@gmail.com>

rht committed Jul 3, 2015 at 08:49 UTC 44245fe015decfb575357f7fea9795a933b86fbb
2 files changed +10
core/pathresolver_test.go
+4
@@ -24,4 +24,8 @@ func TestResolveNoComponents(t *testing.T) {
24 t.Fatal("Should error with no components (/ipfs/).", err)
25 }
26
27 + _, err = core.Resolve(n.Context(), n, path.Path("/../.."))
28 + if err != path.ErrBadPath {
29 + t.Fatal("Should error with invalid path.", err)
30 + }
31 }
test/sharness/t0090-get.sh
+6
@@ -112,6 +112,12 @@ test_get_cmd() {
112 test_cmp dir/b/c "$HASH2"/b/c &&
113 rm -r "$HASH2"
114 '
115 +
116 + test_expect_success "ipfs get ../.. should fail" '
117 + echo "Error: invalid ipfs ref path" >expected &&
118 + test_must_fail ipfs get ../.. 2>actual &&
119 + test_cmp expected actual
120 + '
121 }
122
123 # should work offline