Skip to content

Commit d690472

Browse files
Drive: multi-file Download produces a single .zip
Browsers throttle or block a burst of separate downloads, so selecting several files and pressing Download now bundles them into one .zip (via the existing client-side zipper, so it works for vault files too). A single file still downloads directly.
1 parent 7f59ade commit d690472

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

‎apps/web/src/app/(app)/drive/page.tsx‎

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -834,17 +834,23 @@ export default function EspacesPage() {
834834
toast(t('drive.bulkDeleted', { n: items.length }), 'success');
835835
}
836836
async function bulkDownload() {
837-
const items = entriesByKeys([...selected]);
838-
for (const it of items) {
839-
if (it.kind === 'file') {
840-
const a = document.createElement('a');
841-
a.href = api.url(`/files/${it.file.id}/download`);
842-
a.download = it.file.name;
843-
a.click();
844-
} else if (it.kind === 'zk') {
845-
const blob = await decryptZkBlob(it.zk);
846-
if (blob) saveBlob(blob, zkName(it.zk));
847-
}
837+
const items = entriesByKeys([...selected]).filter((e) => e.kind !== 'folder');
838+
if (items.length === 0) return;
839+
// Several files at once → one .zip (browsers block a burst of separate downloads);
840+
// a single file downloads directly.
841+
if (items.length > 1) {
842+
await zipSelection();
843+
return;
844+
}
845+
const it = items[0]!;
846+
if (it.kind === 'file') {
847+
const a = document.createElement('a');
848+
a.href = api.url(`/files/${it.file.id}/download`);
849+
a.download = it.file.name;
850+
a.click();
851+
} else if (it.kind === 'zk') {
852+
const blob = await decryptZkBlob(it.zk);
853+
if (blob) saveBlob(blob, zkName(it.zk));
848854
}
849855
}
850856
async function bulkMove() {

0 commit comments

Comments
 (0)