diff --git a/aim/web/ui/src/services/live-update/utils.ts b/aim/web/ui/src/services/live-update/utils.ts index 0099cdcc3c..d7af4cdb9c 100644 --- a/aim/web/ui/src/services/live-update/utils.ts +++ b/aim/web/ui/src/services/live-update/utils.ts @@ -58,7 +58,7 @@ export function createGetStream( * @returns String. */ function arrayBufferToString(buffer: ArrayBuffer): string { - return String.fromCharCode.apply(null, Array.from(new Uint16Array(buffer))); + return String.fromCharCode.apply(null, Array.from(new Uint8Array(buffer))); } /** @@ -69,12 +69,12 @@ function arrayBufferToString(buffer: ArrayBuffer): string { */ function stringToArrayBuffer(str: string): ArrayBuffer { const stringLength = str.length; - const buffer = new ArrayBuffer(stringLength * 2); - const bufferView = new Uint16Array(buffer); + const buffer = new ArrayBuffer(stringLength); + const bufferView = new Uint8Array(buffer); for (let i = 0; i < stringLength; i++) { bufferView[i] = str.charCodeAt(i); } - return buffer; + return bufferView; } /**