fix(electron-utils): skip drop files whose path resolution throws (#240)

* fix(electron-utils): skip drop files whose path resolution throws

* fix(electron-utils): extract throwing-resolver guard to satisfy lint

---------

Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
This commit is contained in:
ANIRUDDHA ADAK
2026-09-07 11:10:10 +08:00
committed by GitHub
co-authored by Aniruddha Adak
parent 4e1c6330d1
commit bd46b03ee8
2 changed files with 21 additions and 2 deletions
@@ -101,6 +101,14 @@ describe('droppableFilePaths', () => {
)
expect(result).toEqual(['/tmp/doc.docx'])
})
it('skips files whose path resolution throws instead of aborting the drop', () => {
const result = droppableFilePaths(fileDrag(['bad.docx', 'good.docx']) as never, (file) => {
if ((file as { name: string }).name === 'bad.docx') throw new Error('denied')
return '/tmp/good.docx'
})
expect(result).toEqual(['/tmp/good.docx'])
})
})
describe('partitionDropPayload', () => {