From c903ac821469a807a9958cdbd23ae77763db1435 Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Sat, 12 Jun 2021 23:46:38 +0530 Subject: Upgraded some modules (#1520) --- src/electron/ipc-api/download.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/electron') diff --git a/src/electron/ipc-api/download.js b/src/electron/ipc-api/download.js index 16de66229..7f8718924 100644 --- a/src/electron/ipc-api/download.js +++ b/src/electron/ipc-api/download.js @@ -1,4 +1,4 @@ -import { ipcMain, dialog } from 'electron'; +import { ipcMain, dialog, BrowserWindow } from 'electron'; import { download } from 'electron-dl'; import mime from 'mime-types'; import fs from 'fs-extra'; @@ -17,15 +17,11 @@ function decodeBase64Image(dataString) { export default (params) => { ipcMain.on('download-file', async (event, { url, content, fileOptions = {} }) => { - // We're passing a fake browserWindow to `electron-dl` in order to access the - // webContents of the webview that has initiated the download - const fakeWindow = { - webContents: event.sender.webContents, - }; + const win = BrowserWindow.getFocusedWindow(); try { if (!content) { - const dl = await download(fakeWindow, url, { + const dl = await download(win, url, { saveAs: true, }); debug('File saved to', dl.savePath); -- cgit v1.2.3-54-g00ecf