feat(files): add bulk download for files and guard folder downloads #18

Merged
Esiah merged 1 commits from feat/bulk-download-folders into main 2026-10-24 22:01:16 +00:00
2 changed files with 15 additions and 7 deletions
Showing only changes of commit f05494d674 - Show all commits
+2
View File
@@ -204,6 +204,8 @@ const en: Record<string, string> = {
"{count} éléments seront déplacés.": "{count} items will be moved.",
"{count} élément(s) seront placés dans la corbeille.":
"{count} item(s) will be moved to the trash.",
"Seuls les fichiers peuvent être téléchargés.": "Only files can be downloaded.",
"Les dossiers n'ont pas été téléchargés.": "Folders were not downloaded.",
// --- Visionneuse -------------------------------------------------------
"Lecture impossible.": "Unable to read.",
+13 -7
View File
@@ -636,13 +636,19 @@ export const Browser = () => {
size="sm"
variant="secondary"
onClick={() => {
for (const target of selectedItems) {
if (target.type === "file") {
const link = document.createElement("a");
link.href = api.downloadUrl(target.id);
link.download = target.name;
link.click();
}
const files = selectedItems.filter((t) => t.type === "file");
if (files.length === 0) {
toast.info(t("Seuls les fichiers peuvent être téléchargés."));
return;
}
for (const target of files) {
const link = document.createElement("a");
link.href = api.downloadUrl(target.id);
link.download = target.name;
link.click();
}
if (files.length < selectedItems.length) {
toast.info(t("Les dossiers n'ont pas été téléchargés."));
}
}}
>