From a2da5f2b68422c0d948818e958ddab9107e893ed Mon Sep 17 00:00:00 2001 From: Henry Heino Date: Mon, 11 Nov 2024 06:44:20 -0800 Subject: [PATCH] Desktop: Fix dropping files into the editor --- packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts b/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts index 2b292d9d303..6a3428cbe0f 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts @@ -2,6 +2,7 @@ import { useCallback } from 'react'; import Note from '@joplin/lib/models/Note'; import { DragEvent as ReactDragEvent } from 'react'; import { DropCommandValue } from './types'; +import { webUtils } from 'electron'; interface HookDependencies { // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied @@ -56,8 +57,9 @@ export default function useDropHandler(dependencies: HookDependencies): DropHand const paths = []; for (let i = 0; i < files.length; i++) { const file = files[i]; - if (!file.path) continue; - paths.push(file.path); + const path = webUtils.getPathForFile(file); + if (!path) continue; + paths.push(path); } const props: DropCommandValue = {