Skip to content

Commit

Permalink
Fix: Added fallback when download files fails (#5770)
Browse files Browse the repository at this point in the history
  • Loading branch information
tofarr authored Dec 26, 2024
1 parent c195e46 commit 31bf936
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/utils/download-files.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import OpenHands from "#/api/open-hands";
import { downloadWorkspace } from "./download-workspace";

interface DownloadProgress {
filesTotal: number;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 31bf936

Please sign in to comment.