From 429edde09f358974286a5e8c67db59fde12ce1d1 Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:50:20 -0800 Subject: [PATCH] Make 2nd file download async to fix (#9711) # Addresses #9680 - Add 100ms timeout before 2nd key is downloaded from browser - Fix file decoding to correctly download both keys - Fix copy # Checklist for submitter - [x] Manual QA for all new/changed functionality Co-authored-by: Jacob Shandling Co-authored-by: Roberto Dip --- frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx b/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx index 5c1a1bb31c..a9ddfdbf29 100644 --- a/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx +++ b/frontend/pages/admin/IntegrationsPage/cards/Mdm/Mdm.tsx @@ -105,7 +105,7 @@ const Mdm = (): JSX.Element => { const privateFilename = "fleet-apple-mdm-bm-private.key"; const privateFile = new global.window.File( - [keys.decodedPublic], + [keys.decodedPrivate], privateFilename, { type: "application/x-pem-file", @@ -113,7 +113,9 @@ const Mdm = (): JSX.Element => { ); FileSaver.saveAs(publicFile); - FileSaver.saveAs(privateFile); + setTimeout(() => { + FileSaver.saveAs(privateFile); + }, 100); } else { renderFlash( "error",