Skip to content

Commit

Permalink
fix: ensure frontend doesn’t crash when file is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
sabberworm committed Oct 28, 2024
1 parent 29669b4 commit 8e6a8f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/frontend/model/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ export class Run {
private async loadMessages(response: Promise<Response>) {
for await (const message of streamingFetch<Message>(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;
}
}
Expand Down

0 comments on commit 8e6a8f2

Please sign in to comment.