From d6c65176c07e1232b3821ed39d4a7df5df37ba86 Mon Sep 17 00:00:00 2001 From: Max Schluer Date: Mon, 15 Jan 2024 13:27:14 +0100 Subject: [PATCH 1/2] introduce fix as described in PR 297 --- lib/generate-report.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/generate-report.js b/lib/generate-report.js index 8fdb98c5..3a29bc08 100755 --- a/lib/generate-report.js +++ b/lib/generate-report.js @@ -406,7 +406,17 @@ function generateReport(options) { scenario.steps.forEach((step) => { if (step.embeddings !== undefined) { step.attachments = []; + step.embeddings.forEach((embedding, embeddingIndex) => { + /* Decode Base64 for Text-ish attachements */ + if( + embedding.mime_type === 'application/json' || + embedding.mime_type === 'text/html' || + embedding.mime_type === 'text/plain' + ) { + embedding.data = Buffer.from(embedding.data, 'base64') + } + /* istanbul ignore else */ if ( embedding.mime_type === 'application/json' || From a93c42c4e860e05030b6adcec8be5e4f1d7d34a4 Mon Sep 17 00:00:00 2001 From: Max Schluer Date: Mon, 15 Jan 2024 14:05:56 +0100 Subject: [PATCH 2/2] fix test --- lib/generate-report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/generate-report.js b/lib/generate-report.js index 3a29bc08..13f44dcc 100755 --- a/lib/generate-report.js +++ b/lib/generate-report.js @@ -414,7 +414,7 @@ function generateReport(options) { embedding.mime_type === 'text/html' || embedding.mime_type === 'text/plain' ) { - embedding.data = Buffer.from(embedding.data, 'base64') + embedding.data = Buffer.from(embedding.data.toString(), 'base64') } /* istanbul ignore else */