From 96a1fdd9e4a7e7b7d222698ac996c2bbdf14195d Mon Sep 17 00:00:00 2001 From: Lone Iversen <108085781+loivsen@users.noreply.github.com> Date: Thu, 19 Sep 2024 15:51:16 +0200 Subject: [PATCH] Bugfix: Dropzone thinks custom file extensions are folders --- .../lib/uui-file-dropzone.element.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/uui-file-dropzone/lib/uui-file-dropzone.element.ts b/packages/uui-file-dropzone/lib/uui-file-dropzone.element.ts index a33d3c63e..b37744703 100644 --- a/packages/uui-file-dropzone/lib/uui-file-dropzone.element.ts +++ b/packages/uui-file-dropzone/lib/uui-file-dropzone.element.ts @@ -116,7 +116,10 @@ export class UUIFileDropzoneElement extends LabelMixin('', LitElement) { for (const entry of queue) { if (entry?.kind !== 'file') continue; - if (entry.type) { + const fileEntry = this._getEntry(entry); + if (!fileEntry) continue; + + if (!fileEntry.isDirectory) { // Entry is a file const file = entry.getAsFile(); if (!file) continue; @@ -125,12 +128,8 @@ export class UUIFileDropzoneElement extends LabelMixin('', LitElement) { } } else if (!this.disallowFolderUpload && this.multiple) { // Entry is a directory - const dir = this._getEntry(entry); - - if (dir) { - const structure = await this._mkdir(dir); - folders.push(structure); - } + const structure = await this._mkdir(fileEntry); + folders.push(structure); } }