From 31bf9360fdfa84eea4da2421465d6a845b3c3cae Mon Sep 17 00:00:00 2001 From: tofarr Date: Thu, 26 Dec 2024 09:42:06 -0700 Subject: [PATCH] Fix: Added fallback when download files fails (#5770) --- frontend/src/utils/download-files.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/utils/download-files.ts b/frontend/src/utils/download-files.ts index a392c32eb0a7..1bcd5eb0fd8f 100644 --- a/frontend/src/utils/download-files.ts +++ b/frontend/src/utils/download-files.ts @@ -1,4 +1,5 @@ import OpenHands from "#/api/open-hands"; +import { downloadWorkspace } from "./download-workspace"; interface DownloadProgress { filesTotal: number; @@ -296,14 +297,15 @@ export async function downloadFiles( if (error instanceof Error && error.message === "Download cancelled") { throw error; } - // Re-throw the error as is if it's already a user-friendly message + // Fallback to old style download if ( error instanceof Error && (error.message.includes("browser doesn't support") || error.message.includes("Failed to select") || - error.message === "Download cancelled") + error.message.includes("Permission denied")) ) { - throw error; + await downloadWorkspace(conversationID); + return; } // Otherwise, wrap it with a generic message