BUG ipfs.id() is not a string

This commit is contained in:
Ronan LE MEILLAT 2022-06-10 16:45:55 +02:00 committed by Mark Robert Henderson
parent f7a95d8587
commit 827f7e57fe

View File

@ -119,12 +119,12 @@ class OrbitDB {
} }
if (!options.cache) { if (!options.cache) {
const cachePath = path.join(options.directory, id, '/cache') const cachePath = path.join(options.directory, typeof id !== 'object' ? id : id.toString(), '/cache')
const cacheStorage = await options.storage.createStore(cachePath) const cacheStorage = await options.storage.createStore(cachePath)
options.cache = new Cache(cacheStorage) options.cache = new Cache(cacheStorage)
} }
const finalOptions = Object.assign({}, options, { peerId: id }) const finalOptions = Object.assign({}, options, { peerId: typeof id !== 'object' ? id : id.toString() })
return new OrbitDB(ipfs, options.identity, finalOptions) return new OrbitDB(ipfs, options.identity, finalOptions)
} }