From 616c4c1c33bd18a819468eb4c17a10a58a93976e Mon Sep 17 00:00:00 2001 From: phillmac Date: Fri, 8 Nov 2019 18:28:50 +1100 Subject: [PATCH] Error if address path mismatches manifest name --- src/OrbitDB.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OrbitDB.js b/src/OrbitDB.js index e965c5c..6011350 100644 --- a/src/OrbitDB.js +++ b/src/OrbitDB.js @@ -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)