]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): Show error message if drag-and-drop upload fails
authorFerdinand Thiessen <opensource@fthiessen.de>
Thu, 23 Nov 2023 13:58:43 +0000 (14:58 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Mon, 27 Nov 2023 16:35:14 +0000 (17:35 +0100)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files/src/components/DragAndDropNotice.vue
apps/files/src/views/FilesList.vue

index 1e53556e1f547723b1ffd8ea57290bf59ef8baae..d18f82978a4506b84417f762c11c9b06e3112025 100644 (file)
@@ -34,7 +34,7 @@
 
 <script lang="ts">
 import type { Upload } from '@nextcloud/upload'
-import { showSuccess } from '@nextcloud/dialogs'
+import { showError, showSuccess } from '@nextcloud/dialogs'
 import { translate as t } from '@nextcloud/l10n'
 import { getUploader } from '@nextcloud/upload'
 import { defineComponent } from 'vue'
@@ -105,8 +105,13 @@ export default defineComponent({
 
                                // Start upload
                                logger.debug(`Uploading files to ${this.currentFolder.path}`)
-                               const promises = [...event.dataTransfer.files].map((file: File) => {
-                                       return uploader.upload(file.name, file) as Promise<Upload>
+                               const promises = [...event.dataTransfer.files].map(async (file: File) => {
+                                       try {
+                                               return await uploader.upload(file.name, file)
+                                       } catch (e) {
+                                               showError(t('files', 'Uploading "{filename}" failed', { filename: file.name }))
+                                               throw e
+                                       }
                                })
 
                                // Process finished uploads
index d4c3e0b4d4cd3ca4f1c515a576c253a983ddea24..07366f351a5b3b9749b81c079a191d828bfad5db 100644 (file)
@@ -425,7 +425,7 @@ export default Vue.extend({
 
                                // Define current directory children
                                // TODO: make it more official
-                               Vue.set(folder, '_children', contents.map(node => node.fileid))
+                               this.$set(folder, '_children', contents.map(node => node.fileid))
 
                                // If we're in the root dir, define the root
                                if (dir === '/') {