Skip to content
Open
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
24 changes: 12 additions & 12 deletions apps/files/src/components/FileEntryMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,19 +473,19 @@ export default defineComponent({

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)[]
.map((item) => item.getAsFile()).filter((file): file is File => !!file)
.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) })

let targetPath = this.source.path.replace(this.currentDir || '', '')
if (!targetPath.startsWith('/')) {
targetPath = '/' + targetPath
}
await uploader.batchUpload(
relativePath,
targetPath,
files,
async (nodes, path) => {
try {
const { contents, folder } = await this.activeView!.getContents(path)
const { contents, folder } = await this.currentView!.getContents(path)
const conflicts = getConflicts(nodes, contents)
if (conflicts.length === 0) {
return nodes
Expand Down Expand Up @@ -517,17 +517,17 @@ export default defineComponent({
}

// We might not have the target directory fetched yet
const cachedContents = this.filesStore.getNodesByPath(this.activeView.id, this.source.path)
const cachedContents = this.filesStore.getNodesByPath(this.currentView.id, this.source.path)
const contents = cachedContents.length === 0
? (await this.activeView!.getContents(this.source.path)).contents
? (await this.currentView!.getContents(this.source.path)).contents
: cachedContents

const isCopy = event.ctrlKey
this.dragover = false

logger.debug('Dropped', { event, folder: this.source, selection })
logger.debug('Dropped', { event, folder: this.source, selection, contents })

const nodes = selection.map((source) => this.filesStore.getNode(source)) as Node[]
const nodes = selection.map((source) => this.filesStore.getNode(source)).filter((node): node is Node => !!node)
await onDropInternalFiles(nodes, this.source, contents, isCopy)

// Reset selection after we dropped the files
Expand Down
Loading