Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 11 additions & 6 deletions apps/files/src/components/FileEntryMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { generateUrl } from '@nextcloud/router'
import { isPublicShare } from '@nextcloud/sharing/public'
import { getConflicts, getUploader } from '@nextcloud/upload'
import { vOnClickOutside } from '@vueuse/components'
import { extname } from 'path'
import { extname, relative } from 'path'
import Vue, { computed, defineComponent } from 'vue'
import { action as sidebarAction } from '../actions/sidebarAction.ts'
import { onDropInternalFiles } from '../services/DropService.ts'
Expand Down Expand Up @@ -488,12 +488,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)
Expand Down Expand Up @@ -536,7 +541,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)
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/services/DropService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export async function onDropExternalFiles(root: RootDirectory, destination: IFol
// 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) {
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

Loading