Skip to content

Commit

Permalink
Merge pull request #13357 from opf/bug/49518-uploading-a-folder-to-ne…
Browse files Browse the repository at this point in the history
…xtcloud-fails-with-wrong-error-message

[#49518] Uploading a folder to Nextcloud fails with wrong error message
  • Loading branch information
ulferts authored Aug 4, 2023
2 parents fd1bf80 + 0cacf5e commit 90e579e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions modules/storages/config/locales/js-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 90e579e

Please sign in to comment.