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

dht.provide() should accept string keys (#2573) #2589

Merged
merged 3 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"execa": "^3.0.0",
"form-data": "^2.5.1",
"hat": "0.0.3",
"interface-ipfs-core": "^0.118.0",
"interface-ipfs-core": "^0.119.0",
"ipfs-interop": "^0.1.1",
"ipfsd-ctl": "^0.47.2",
"libp2p-websocket-star": "~0.10.2",
Expand Down
10 changes: 10 additions & 0 deletions src/core/components/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ module.exports = (self) => {
if (!Array.isArray(keys)) {
keys = [keys]
}
for (var i in keys) {
if (typeof keys[i] === 'string') {
try {
keys[i] = new CID(keys[i])
} catch (err) {
log.error(err)
throw errcode(err, 'ERR_INVALID_CID')
}
}
}

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