From 4eec29503558d7a25d82d982135b747cca83e806 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Wed, 26 Aug 2020 17:14:23 +0200 Subject: [PATCH] parse --- packages/health-check/src/verboseChecks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/health-check/src/verboseChecks.js b/packages/health-check/src/verboseChecks.js index af19d573..05de4048 100644 --- a/packages/health-check/src/verboseChecks.js +++ b/packages/health-check/src/verboseChecks.js @@ -518,16 +518,16 @@ function skylinkVerification(done, linkInfo) { // Check if the response body is valid by checking against the known // hash const validBody = hash(res.body) === linkInfo.bodyHash; - // Check if the metadata is valid by checking against the known - // hash - const validMetadata = isEqual(res.header["skynet-file-metadata"], linkInfo.metadata); + // Check if the metadata is valid + const metadata = res.header["skynet-file-metadata"] ? JSON.parse(res.header["skynet-file-metadata"]) : null; + const validMetadata = isEqual(metadata, linkInfo.metadata); // Redetermine if the Skylink is up based on the results from the body // and metadata hash checks up = up && validBody && validMetadata; info = { body: { valid: validBody }, - metadata: { valid: validMetadata, diff: detailedDiff(res.header["skynet-file-metadata"], linkInfo.metadata) }, + metadata: { valid: validMetadata, diff: detailedDiff(metadata, linkInfo.metadata) }, }; }