Fix: Added fallback when download files fails (#5770)

This commit is contained in:
tofarr
2024-12-26 09:42:06 -07:00
committed by GitHub
parent c195e467ee
commit 31bf9360fd

View File

@@ -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