Skip to content

Commit c1278c6

Browse files
mschluerMax Schluer
and
Max Schluer
authored
Decode base64-encoded Text Attachments (#308)
* introduce fix as described in PR 297 * fix test --------- Co-authored-by: Max Schluer <mail@maximilian-schluer.com>
1 parent 20c338c commit c1278c6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/generate-report.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,17 @@ function generateReport(options) {
406406
scenario.steps.forEach((step) => {
407407
if (step.embeddings !== undefined) {
408408
step.attachments = [];
409+
409410
step.embeddings.forEach((embedding, embeddingIndex) => {
411+
/* Decode Base64 for Text-ish attachements */
412+
if(
413+
embedding.mime_type === 'application/json' ||
414+
embedding.mime_type === 'text/html' ||
415+
embedding.mime_type === 'text/plain'
416+
) {
417+
embedding.data = Buffer.from(embedding.data.toString(), 'base64')
418+
}
419+
410420
/* istanbul ignore else */
411421
if (
412422
embedding.mime_type === 'application/json' ||

0 commit comments

Comments
 (0)