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

Commit 53c2144

Browse files
reasvAlan Shaw
authored and
Alan Shaw
committed
fix: dht.provide() should accept string keys (#2573) (#2589)
* dht.provide() should accept string keys (#2573) * FIx linting issues * chore: update interface-ipfs-core dep
1 parent 1d12ffb commit 53c2144

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
"execa": "^3.0.0",
205205
"form-data": "^3.0.0",
206206
"hat": "0.0.3",
207-
"interface-ipfs-core": "^0.118.0",
207+
"interface-ipfs-core": "^0.119.0",
208208
"ipfs-interop": "^0.1.1",
209209
"ipfsd-ctl": "^0.47.2",
210210
"libp2p-websocket-star": "~0.10.2",

src/core/components/dht.js

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ module.exports = (self) => {
119119
if (!Array.isArray(keys)) {
120120
keys = [keys]
121121
}
122+
for (var i in keys) {
123+
if (typeof keys[i] === 'string') {
124+
try {
125+
keys[i] = new CID(keys[i])
126+
} catch (err) {
127+
log.error(err)
128+
throw errcode(err, 'ERR_INVALID_CID')
129+
}
130+
}
131+
}
122132

123133
// ensure blocks are actually local
124134
const has = await every(keys, (key) => {

0 commit comments

Comments
 (0)