From 5f894afb22c61f9149b11d3ee067cf08fe5fca8f Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Tue, 19 May 2026 23:09:04 +0200 Subject: [PATCH] fix(files): use type field instead of instanceof for Folder Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- apps/files/src/components/FileEntryMixin.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 75c3afa99d6..2471ced4009 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -497,7 +497,10 @@ export default defineComponent({ // canDrop already gates this branch on FileType.Folder, but the // type system can't see that — narrow defensively so a future // loosening of canDrop can't silently lie via the cast below. - if (!(this.source instanceof Folder)) { + // Use the `type` field rather than `instanceof Folder`: apps + // bundle their own copy of @nextcloud/files, so a Folder from + // an app would not be `instanceof` the server's Folder class. + if (this.source.type !== FileType.Folder) { logger.error('onDrop: external drop target is not a Folder', { source: this.source }) this.dragover = false return @@ -510,7 +513,7 @@ export default defineComponent({ : cachedContents logger.debug('Start uploading dropped files', { target: this.source.path, fileTree }) - await onDropExternalFiles(fileTree, this.source, contents) + await onDropExternalFiles(fileTree, this.source as Folder, contents) this.dragover = false return }