Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#49518] Uploading a folder to Nextcloud fails with wrong error message

Eric Schubert0cacf5e4ffce
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 6b9243ae51f..49aa8637545 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 f5bdb891a1a..275104d81a9 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."