diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index b47660f3529fb..0831c50afd6f8 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -14,6 +14,7 @@ import { isPublicShare } from '@nextcloud/sharing/public' import { generateUrl } from '@nextcloud/router' import { getConflicts, getUploader } from '@nextcloud/upload' import { vOnClickOutside } from '@vueuse/components' +import { relative } from 'path' import Vue, { computed, defineComponent } from 'vue' import { action as sidebarAction } from '../actions/sidebarAction.ts' @@ -471,12 +472,17 @@ export default defineComponent({ const items = Array.from(event.dataTransfer?.items || []) if (selection.length === 0 && items.some((item) => item.kind === 'file')) { + const files = items.filter((item) => item.kind === 'file') + .map((item) => 'webkitGetAsEntry' in item ? item.webkitGetAsEntry() : item.getAsFile()) + .filter(Boolean) as (FileSystemEntry | File)[] const uploader = getUploader() + const root = uploader.destination.path + const relativePath = relative(root, this.source.path) + logger.debug('Start uploading dropped files', { target: this.source.path, root, relativePath, files: files.map((file) => file.name) }) + await uploader.batchUpload( - this.source.path, - items.filter((item) => item.kind === 'file') - .map((item) => 'webkitGetAsEntry' in item ? item.webkitGetAsEntry() : item.getAsFile()) - .filter(Boolean) as (FileSystemEntry | File)[], + relativePath, + files, async (nodes, path) => { try { const { contents, folder } = await this.activeView!.getContents(path) @@ -519,7 +525,7 @@ export default defineComponent({ const isCopy = event.ctrlKey this.dragover = false - logger.debug('Dropped', { event, folder: this.source, selection, fileTree }) + logger.debug('Dropped', { event, folder: this.source, selection }) const nodes = selection.map((source) => this.filesStore.getNode(source)) as Node[] await onDropInternalFiles(nodes, this.source, contents, isCopy) diff --git a/apps/files/src/services/DropService.ts b/apps/files/src/services/DropService.ts index cd2588ee5b9c7..7970624eba73a 100644 --- a/apps/files/src/services/DropService.ts +++ b/apps/files/src/services/DropService.ts @@ -123,7 +123,7 @@ export async function onDropExternalFiles(root: RootDirectory, destination: Fold // then browse its tree and upload its contents. if (file instanceof Directory) { try { - logger.debug('Processing directory', { relativePath }) + logger.debug('Processing directory', { relativePath, destination }) await createDirectoryIfNotExists(relativePath, destination) await uploadDirectoryContents(file, relativePath) } catch (error) {