fix(desktop): restore remote file picker attachments
This commit is contained in:
@@ -142,12 +142,22 @@ describe('desktop filesystem facade', () => {
|
||||
expect(selectPaths).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('uses the local Electron picker for remote file selection', async () => {
|
||||
const remoteSelect = vi.fn(async () => ['/remote/project'])
|
||||
$connection.set({ mode: 'remote' } as never)
|
||||
setDesktopFsRemotePicker({ selectPaths: remoteSelect })
|
||||
|
||||
await expect(selectDesktopPaths({ directories: false, multiple: false })).resolves.toEqual(['/local'])
|
||||
|
||||
expect(selectPaths).toHaveBeenCalledWith({ directories: false, multiple: false })
|
||||
expect(remoteSelect).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('limits the remote picker to single-directory selection', async () => {
|
||||
const remoteSelect = vi.fn(async () => ['/remote/project'])
|
||||
$connection.set({ mode: 'remote' } as never)
|
||||
setDesktopFsRemotePicker({ selectPaths: remoteSelect })
|
||||
|
||||
await expect(selectDesktopPaths({ directories: false, multiple: false })).resolves.toEqual([])
|
||||
await expect(selectDesktopPaths({ directories: true })).resolves.toEqual(['/remote/project'])
|
||||
|
||||
expect(remoteSelect).toHaveBeenCalledWith({ directories: true, multiple: false })
|
||||
|
||||
@@ -179,7 +179,7 @@ export async function selectDesktopPaths(options?: HermesSelectPathsOptions): Pr
|
||||
}
|
||||
|
||||
if (!options?.directories) {
|
||||
return []
|
||||
return desktop.selectPaths(options)
|
||||
}
|
||||
|
||||
return remotePicker ? remotePicker.selectPaths({ ...options, multiple: false }) : []
|
||||
|
||||
Reference in New Issue
Block a user