Skip to content

Commit

Permalink
fix: no more object with slash for CID (#42)
Browse files Browse the repository at this point in the history
As of [email protected] 

> Cids are JSON-ified as '"Qm...."' instead of '{ "/": "Qm....." }'

see: ipfs-cluster/ipfs-cluster#1626
  • Loading branch information
Alan Shaw authored Apr 8, 2022
1 parent 5088097 commit e078957
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:

cluster0:
container_name: cluster0
image: ipfs/ipfs-cluster:v1.0.0-rc3
image: ipfs/ipfs-cluster:v1.0.0-rc4
depends_on:
- ipfs0
environment:
Expand Down Expand Up @@ -79,7 +79,7 @@ services:

cluster1:
container_name: cluster1
image: ipfs/ipfs-cluster:v1.0.0-rc3
image: ipfs/ipfs-cluster:v1.0.0-rc4
depends_on:
- ipfs1
environment:
Expand All @@ -105,7 +105,7 @@ services:

cluster2:
container_name: cluster2
image: ipfs/ipfs-cluster:v1.0.0-rc3
image: ipfs/ipfs-cluster:v1.0.0-rc4
depends_on:
- ipfs2
environment:
Expand Down
10 changes: 3 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const add = async (cluster, file, options = {}) => {
signal: options.signal
})
const data = params['stream-channels'] ? result : result[0]
return { ...data, cid: data.cid['/'] }
return { ...data, cid: data.cid }
} catch (err) {
const error = /** @type {Error & {response?:Response}} */ (err)
if (error.response?.ok) {
Expand Down Expand Up @@ -118,10 +118,6 @@ export const addDirectory = async (cluster, files, options = {}) => {
signal: options.signal
})

for (const f of results) {
f.cid = f.cid['/']
}

return results
}

Expand Down Expand Up @@ -560,7 +556,7 @@ const toPinResponse = (data) => {
expireAt: new Date(data.expire_at),
metadata: data.metadata,
pinUpdate: data.pin_update,
cid: data.cid['/'],
cid: data.cid,
type: data.type,
allocations: data.allocations,
maxDepth: data.max_depth,
Expand Down Expand Up @@ -588,7 +584,7 @@ const toStatusResponse = (data) => {
])
)
}
return { cid: data.cid['/'], name: data.name, peerMap }
return { cid: data.cid, name: data.name, peerMap }
}

/**
Expand Down

0 comments on commit e078957

Please sign in to comment.