Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

IPLD formats are overwritten in nodejs #3129

Closed
oed opened this issue Jun 26, 2020 · 0 comments · Fixed by #3132
Closed

IPLD formats are overwritten in nodejs #3129

oed opened this issue Jun 26, 2020 · 0 comments · Fixed by #3132
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@oed
Copy link
Contributor

oed commented Jun 26, 2020

  • Version: 0.46.0
  • Platform: nodejs
  • Subsystem: ipld

Severity: Low

Description:

When specifying a custom ipld format when creating an ipfs instance the default formats get overwritten. This seems to be happening since the default formats are not defined in the nodejs config for ipld: https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/src/core/runtime/ipld-nodejs.js (Ipld just uses the passed formats array without merging with it's defaults)

In the browser config it looks like it should work since the passed formats array should be merged with the default one, but I have not confirmed.

Steps to reproduce the error:

Run this in nodejs with a custom myFormat.

const ipfs = await Ipfs.create({ ipld: { formats: [myFormat] } })
@oed oed added the need/triage Needs initial labeling and prioritization label Jun 26, 2020
achingbrain added a commit that referenced this issue Jun 29, 2020
If we specify a `formats` array as part of the ipld options in in-proc
nodes, it replaces the default list of dag-pb, dag-cbor and raw.

This change allows the `loadFormat` function to still resolve those
formats even if the user has passed a `format` array that does not
contain them.

Fixes #3129
@achingbrain achingbrain added kind/bug A bug in existing code (including security flaws) and removed need/triage Needs initial labeling and prioritization labels Jun 29, 2020
achingbrain added a commit that referenced this issue Jul 1, 2020
…ts (#3132)

If we specify a `formats` array as part of the ipld options in in-proc
nodes, it replaces the default list of dag-pb, dag-cbor and raw.

This change allows the `loadFormat` function to still resolve those
formats even if the user has passed a `format` array that does not
contain them.

Fixes #3129
SgtPooki referenced this issue in ipfs/js-kubo-rpc-client Aug 18, 2022
…ts (#3132)

If we specify a `formats` array as part of the ipld options in in-proc
nodes, it replaces the default list of dag-pb, dag-cbor and raw.

This change allows the `loadFormat` function to still resolve those
formats even if the user has passed a `format` array that does not
contain them.

Fixes #3129
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants