aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-11-23 14:58:43 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2023-12-05 13:04:29 +0100
commit96c477d86d63f198721fa72ae6cef17312de431e (patch)
treeb531be7efbf9feeafe697c39b997195ad4454d0c /apps/files
parent89e01eafee1a14798ad9f87ddd32751c9eaa0490 (diff)
downloadnextcloud-server-96c477d86d63f198721fa72ae6cef17312de431e.tar.gz
nextcloud-server-96c477d86d63f198721fa72ae6cef17312de431e.zip
fix(files): Show error message if drag-and-drop upload fails
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/components/DragAndDropNotice.vue11
-rw-r--r--apps/files/src/views/FilesList.vue2
2 files changed, 9 insertions, 4 deletions
diff --git a/apps/files/src/components/DragAndDropNotice.vue b/apps/files/src/components/DragAndDropNotice.vue
index 1e53556e1f5..d18f82978a4 100644
--- a/apps/files/src/components/DragAndDropNotice.vue
+++ b/apps/files/src/components/DragAndDropNotice.vue
@@ -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
diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue
index d4c3e0b4d4c..07366f351a5 100644
--- a/apps/files/src/views/FilesList.vue
+++ b/apps/files/src/views/FilesList.vue
@@ -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 === '/') {