From 8e6a8f209c369335accad8560cfcab1338a36490 Mon Sep 17 00:00:00 2001 From: Raphael Schweikert Date: Mon, 28 Oct 2024 16:31:25 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20ensure=20frontend=20doesn=E2=80=99t=20cr?= =?UTF-8?q?ash=20when=20file=20is=20empty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/frontend/model/Run.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/model/Run.ts b/src/main/frontend/model/Run.ts index 3c344eb..f07e667 100644 --- a/src/main/frontend/model/Run.ts +++ b/src/main/frontend/model/Run.ts @@ -104,8 +104,9 @@ export class Run { private async loadMessages(response: Promise) { for await (const message of streamingFetch(await response)) { if (typeof message !== 'string') { - if (message.type === 'file' && message.data) { - message.blob = new Blob([decodeBase64(message.data)], { type: message.mime }); + if (message.type === 'file') { + const data = message.data ? decodeBase64(message.data) : new Uint8Array(0); + message.blob = new Blob([data], { type: message.mime }); delete message.data; } }