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

Commit

Permalink
fix(rmlink): fix rmlink to match docs (#4073)
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb-mabry committed Apr 1, 2022
1 parent c51b160 commit 1a73160
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/core-api/OBJECT.md
Expand Up @@ -398,9 +398,9 @@ An optional object which may have the following keys:
```JavaScript
// cid is CID of the DAG node created by removing a link
const cid = await ipfs.object.patch.rmLink(node, {
name: 'some-link',
size: 10,
cid: CID.parse('QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD')
Name: 'some-link',
Tsize: 10,
Hash: CID.parse('QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD')
})
```

Expand Down
6 changes: 3 additions & 3 deletions packages/ipfs-core/src/components/object/patch/rm-link.js
Expand Up @@ -14,9 +14,9 @@ export function createRmLink ({ repo, preload }) {
/**
* @type {import('ipfs-core-types/src/object/patch').API<{}>["rmLink"]}
*/
async function rmLink (multihash, linkRef, options = {}) {
const node = await get(multihash, options)
const name = (typeof linkRef === 'string' ? linkRef : linkRef.Name) || ''
async function rmLink (cid, link, options = {}) {
const node = await get(cid, options)
const name = (typeof link === 'string' ? link : link.Name) || ''

node.Links = node.Links.filter(l => l.Name !== name)

Expand Down

0 comments on commit 1a73160

Please sign in to comment.