Js-ipfs: object.put(dagNode) gives error: links is immutable, but object.put(dagNode.toJSON().data) works

Created on 3 Aug 2018  路  3Comments  路  Source: ipfs/js-ipfs

  • Version: 0.31
  • Platform: latest nodejs 8 on Linux x64
  • Subsystem: Object API (from JS, not HTTP)

Type: Bug

Severity: Low

Description:

See https://github.com/ChluNetwork/chlu-ipfs-support/pull/112/commits/2bd6d4c86f76f849dcd7b8efac3c32245ec3c5eb#diff-a8513da2877ad6ccd1d7f8af480d9b21R135

In short, ipfs.object.put(dagNode) where dagNode is an instance of DAGNode used to work fine. Now it throws an links is immutable error.

However, doing ipfs.object.put(dagNode.toJSON().data) works fine and looks like it produces the same result.

Steps to reproduce the error:

Something like:


async function createDAGNode(buf) {esolve, reject) => {
        // DAGNode from ipld-dag-pb
        DAGNode.create(buf, [], (err, dagNode) => {
            if (err) reject(err); else resolve(dagNode);
        });
    });
}

const dagNode = await createDAGNode(Buffer.from('helloo'))

// this works
const multihash = await ipfs.object.put(dagNode.toJSON().data)

// this does not work, but the API Spec supports it and it worked in 0.28.2
const multihash2 = await ipfs.object.put(dagNode)
P3 dihard help wanted

Most helpful comment

I would like to work in this issue 馃憤
could you help. @fazo96

All 3 comments

I would like to work in this issue 馃憤
could you help. @fazo96

@vmx can you also check this one?

Works on master, got fixed by https://github.com/ipfs/js-ipfs/commit/a82a5dcf7151fc900998578d0e03b3ab522fa244#diff-98e868a7effb24c7531c970fa7e3cd96R186.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daviddias picture daviddias  路  3Comments

dryajov picture dryajov  路  3Comments

npfoss picture npfoss  路  3Comments

daviddias picture daviddias  路  3Comments

daviddias picture daviddias  路  4Comments