From cdcdc43cad7cbb1a08330bc0959da096ae1097a6 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 24 Jul 2024 12:35:01 +0500 Subject: [PATCH] web: fix encryption progress when attaching files --- apps/web/src/components/editor/picker.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/editor/picker.ts b/apps/web/src/components/editor/picker.ts index 5da44f7aa..6d61b8807 100644 --- a/apps/web/src/components/editor/picker.ts +++ b/apps/web/src/components/editor/picker.ts @@ -240,14 +240,13 @@ function withProgress( ({ type, total, loaded }: AttachmentProgress) => { if (type !== "encrypt") return; report({ - current: loaded, - total: total, + current: Math.round((loaded / total) * 100), + total: 100, text: file.name }); } ); - event.unsubscribe(); - return action(); + return action().finally(() => event.unsubscribe()); } }); }