Browse Source

Make sure url in 'image:download' is always a string.

pull/3202/head
TheGoddessInari 5 years ago
parent
commit
fa8d5f9c0a
No known key found for this signature in database
GPG Key ID: 1209B1B7632D69A
  1. 4
      electron/main.js

4
electron/main.js

@ -357,7 +357,7 @@ let imageCache = {};
ipcMain.on('image:download', function(event, url, partition) {
const tmp = require('tmp');
const mime = require('mime');
let file = imageCache[url];
let file = imageCache[`${url}`];
if (file) {
if (file.complete) {
shell.openItem(file.path);
@ -375,7 +375,7 @@ ipcMain.on('image:download', function(event, url, partition) {
});
tmpWindow.webContents.session.once('will-download', (event, downloadItem) => {
imageCache[url] = file = {
imageCache[`${url}`] = file = {
path: tmp.tmpNameSync() + '.' + mime.getExtension(downloadItem.getMimeType())
,complete: false
};

Loading…
Cancel
Save