feat(files): add bulk download for files and guard folder downloads
PR — Ouverture automatique / create-pr (push) Successful in 2s
PR — Ouverture automatique / create-pr (push) Successful in 2s
This commit is contained in:
@@ -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.",
|
||||
|
||||
@@ -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."));
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user