mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 03:17:43 +08:00
namesys: allow non /ipfs paths
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
e335fd32f2
commit
462c8026be
@ -63,7 +63,7 @@ func resolveAsync(ctx context.Context, r resolver, name string, options opts.Res
|
||||
return
|
||||
}
|
||||
log.Debugf("resolved %s to %s", name, res.value.String())
|
||||
if strings.HasPrefix(res.value.String(), "/ipfs/") {
|
||||
if !strings.HasPrefix(res.value.String(), ipnsPrefix) {
|
||||
outCh <- Result{Path: res.value}
|
||||
break
|
||||
}
|
||||
|
||||
@ -114,6 +114,27 @@ test_expect_success "publish an explicit node ID as key name looks good" '
|
||||
test_cmp expected_node_id_publish actual_node_id_publish
|
||||
'
|
||||
|
||||
# test IPNS + IPLD
|
||||
test_expect_success "'ipfs dag put' succeeds" '
|
||||
HELLO_HASH="$(echo "\"hello world\"" | ipfs dag put)" &&
|
||||
OBJECT_HASH="$(echo "{\"thing\": {\"/\": \"${HELLO_HASH}\" }}" | ipfs dag put)"
|
||||
'
|
||||
test_expect_success "'ipfs name publish --allow-offline /ipld/...' succeeds" '
|
||||
PEERID=`ipfs id --format="<id>"` &&
|
||||
test_check_peerid "${PEERID}" &&
|
||||
ipfs name publish --allow-offline "/ipld/$OBJECT_HASH/thing" >publish_out
|
||||
'
|
||||
test_expect_success "publish a path looks good" '
|
||||
echo "Published to ${PEERID}: /ipld/$OBJECT_HASH/thing" >expected3 &&
|
||||
test_cmp expected3 publish_out
|
||||
'
|
||||
test_expect_success "'ipfs name resolve' succeeds" '
|
||||
ipfs name resolve "$PEERID" >output
|
||||
'
|
||||
test_expect_success "resolve output looks good" '
|
||||
printf "/ipld/%s/thing\n" "$OBJECT_HASH" >expected4 &&
|
||||
test_cmp expected4 output
|
||||
'
|
||||
|
||||
# test publishing nothing
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user