From 818653ecfc9b9bd4849c7b558aefc2676b7e3750 Mon Sep 17 00:00:00 2001 From: DongHyun Kim Date: Wed, 6 Nov 2024 09:45:39 +0900 Subject: [PATCH] fix(message): Fixed bug in final length calculation in Multipart Encoded Previously, footerLength was added as many times as the number of contents, but we changed it to adding it only once at the end. --- src/message.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/message.js b/src/message.js index 7d6224f..ab3e9cc 100644 --- a/src/message.js +++ b/src/message.js @@ -149,11 +149,13 @@ function multipartEncode( const contentArray = new Uint8Array(datasetBuffer); const contentLength = contentArray.length; - length += headerLength + contentLength + footerLength; + length += headerLength + contentLength return contentArray; }); + length += footerLength; + // Allocate the array const multipartArray = new Uint8Array(length);