feat(files): add bulk download for files and guard folder downloads (#18)
CD — Deployment / deploy (push) Successful in 15s
CD — Deployment / deploy (push) Successful in 15s
PR automatique de feat/bulk-download-folders vers main. --------- Co-authored-by: xEsiah <[email protected]> Reviewed-on: #18 Reviewed-by: Esiah <[email protected]> Co-authored-by: Gitea Actions <-[email protected]>
This commit was merged in pull request #18.
This commit is contained in:
@@ -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