diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.ts index 6b9243ae51fc..49aa86375451 100644 --- a/frontend/src/app/shared/components/storages/storage/storage.component.ts +++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts @@ -158,6 +158,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD }, ), draggingManyFiles: (storageType:string):string => this.i18n.t('js.storages.files.dragging_many_files', { storageType }), + draggingFolder: (storageType:string):string => this.i18n.t('js.storages.files.dragging_folder', { storageType }), uploadingLabel: this.i18n.t('js.label_upload_notification'), }, dropBox: { @@ -519,11 +520,15 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD this.dragging = 0; const files = event.dataTransfer.files; - if (files.length !== 1) { + const draggingManyFiles = files.length !== 1; + const isDirectory = event.dataTransfer.items[0].webkitGetAsEntry()?.isDirectory; + if (draggingManyFiles || isDirectory) { this.storageType .pipe(first()) .subscribe((storageType) => { - const toast = this.text.toast.draggingManyFiles(storageType); + const toast = draggingManyFiles + ? this.text.toast.draggingManyFiles(storageType) + : this.text.toast.draggingFolder(storageType); this.toastService.addError(toast); }); return; diff --git a/modules/storages/config/locales/js-en.yml b/modules/storages/config/locales/js-en.yml index f5bdb891a1a4..275104d81a9a 100644 --- a/modules/storages/config/locales/js-en.yml +++ b/modules/storages/config/locales/js-en.yml @@ -36,6 +36,7 @@ en: to upload this file. What would you like to do? directory_not_writeable: "You do not have permission to add files to this folder." dragging_many_files: "The upload to %{storageType} supports only one file at once." + dragging_folder: "The upload to %{storageType} does not support folders." empty_folder: "This folder is empty." empty_folder_location_hint: "Click the button below to upload the file to this location." file_not_selectable_location: "Selecting a file is not possible in the process of choosing a location."