Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(files): Show error message if drag-and-drop upload fails
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Dec 5, 2023
commit 96c477d86d63f198721fa72ae6cef17312de431e
11 changes: 8 additions & 3 deletions apps/files/src/components/DragAndDropNotice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 === '/') {
Expand Down