0.37.1: fix folder-download hang/501 on special files + add download progress

Two issues with the 0.37.0 folder zip-download:

1. Hang / server error (reported as 501) on "some folders". archive_dir
   tried to zip every entry, including non-regular files. Opening a FIFO
   blocks forever (no writer); a unix socket / unreadable file raised an
   OSError that aborted the whole archive. Now only real regular files are
   zipped — FIFOs, sockets, devices and symlinks are skipped without ever
   open()-ing them, and a per-file read error skips just that file instead
   of failing the download.

2. No feedback while a large folder is being prepared. The zip is built
   server-side before any bytes flow, so the click felt dead. The Files
   page now shows an indeterminate "Preparing <name>…" bar from click,
   switching to a real percentage during the transfer (Content-Length is
   known for the finished zip). filesApi.download forwards onDownloadProgress.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
menzelj
2026-06-21 20:11:50 +00:00
co-authored by Claude Opus 4.8
parent f1782eca0e
commit 0dc430bb2a
6 changed files with 97 additions and 23 deletions
+13 -2
View File
@@ -58,8 +58,19 @@ export const filesApi = {
.post<{ path: string }>(`${base(agentId)}/move`, { src, dest_dir: destDir, overwrite })
.then((r) => r.data),
download: async (path: string, filename: string, agentId?: number) => {
const res = await api.get(`${base(agentId)}/download`, { params: { path }, responseType: "blob" });
download: async (
path: string,
filename: string,
agentId?: number,
onProgress?: (loaded: number, total: number | undefined) => void,
) => {
const res = await api.get(`${base(agentId)}/download`, {
params: { path },
responseType: "blob",
onDownloadProgress: onProgress
? (e) => onProgress(e.loaded, e.total || undefined)
: undefined,
});
triggerDownload(res.data as Blob, filename);
},