@cryptotaxi247 / kubo / commits / 462c8026b

namesys: allow non /ipfs paths

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Oct 16, 2018 at 16:37 UTC 462c8026befd1bf576facb97887d2f030aeb59fd
2 files changed +22 -1
namesys/base.go
+1 -1
@@ -63,7 +63,7 @@ func resolveAsync(ctx context.Context, r resolver, name string, options opts.Res
63 return
64 }
65 log.Debugf("resolved %s to %s", name, res.value.String())
66 - if strings.HasPrefix(res.value.String(), "/ipfs/") {
66 + if !strings.HasPrefix(res.value.String(), ipnsPrefix) {
67 outCh <- Result{Path: res.value}
68 break
69 }
test/sharness/t0100-name.sh
+21
@@ -114,6 +114,27 @@ test_expect_success "publish an explicit node ID as key name looks good" '
114 test_cmp expected_node_id_publish actual_node_id_publish
115 '
116
117 +# test IPNS + IPLD
118 +test_expect_success "'ipfs dag put' succeeds" '
119 + HELLO_HASH="$(echo "\"hello world\"" | ipfs dag put)" &&
120 + OBJECT_HASH="$(echo "{\"thing\": {\"/\": \"${HELLO_HASH}\" }}" | ipfs dag put)"
121 +'
122 +test_expect_success "'ipfs name publish --allow-offline /ipld/...' succeeds" '
123 + PEERID=`ipfs id --format="<id>"` &&
124 + test_check_peerid "${PEERID}" &&
125 + ipfs name publish --allow-offline "/ipld/$OBJECT_HASH/thing" >publish_out
126 +'
127 +test_expect_success "publish a path looks good" '
128 + echo "Published to ${PEERID}: /ipld/$OBJECT_HASH/thing" >expected3 &&
129 + test_cmp expected3 publish_out
130 +'
131 +test_expect_success "'ipfs name resolve' succeeds" '
132 + ipfs name resolve "$PEERID" >output
133 +'
134 +test_expect_success "resolve output looks good" '
135 + printf "/ipld/%s/thing\n" "$OBJECT_HASH" >expected4 &&
136 + test_cmp expected4 output
137 +'
138
139 # test publishing nothing
140