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:
co-authored by
Aniruddha Adak
parent
4e1c6330d1
commit
bd46b03ee8
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user