Error if address path mismatches manifest name

This commit is contained in:
phillmac 2019-11-08 18:28:50 +11:00 committed by GitHub
parent e871fd2bb1
commit 616c4c1c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -433,8 +433,9 @@ class OrbitDB {
logger.debug(`Manifest for '${dbAddress}':\n${JSON.stringify(manifest, null, 2)}`)
// Make sure the type from the manifest matches the type that was given as an option
if (manifest.name !== dbAddress.path) { throw new Error(`Manifest '${manifest.name}' cannot be opened as '${dbAddress.path}'`) }
if (options.type && manifest.type !== options.type) { throw new Error(`Database '${dbAddress}' is type '${manifest.type}' but was opened as '${options.type}'`) }
// Save the database locally
await this._addManifestToCache(options.cache, dbAddress)