diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 313a4149..08338353 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -600,12 +600,21 @@ ipcMain.on( ipcMain.on( FileChannel.SelectSaveFilePath, (event: IpcMainEvent, ...args: any[]) => { + const defaultPath = args[0]; + const ext = path.extname(defaultPath); dialog - .showSaveDialog({ defaultPath: args[0] }) + .showSaveDialog({ + defaultPath + }) .then(obj => { + const filePath = + '' !== ext && '' === path.extname(obj.filePath) + ? `${obj.filePath}${ext}` + : obj.filePath; + event.returnValue = { canceled: obj.canceled, - filePath: obj.filePath + filePath }; }) .catch(obj => {