Browse Source

Merge pull request #9352 from vector-im/travis/save-as-2

Don't try to save files the user didn't want to save
pull/9363/head
Travis Ralston 3 years ago committed by GitHub
parent
commit
958260d559
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      electron_app/src/webcontents-handler.js

3
electron_app/src/webcontents-handler.js

@ -96,13 +96,14 @@ function onLinkContextMenu(ev, params) {
defaultPath: targetFileName,
});
if (!filePath) return; // user cancelled dialog
try {
if (url.startsWith("data:")) {
fs.writeFileSync(filePath, nativeImage.createFromDataURL(url));
} else {
request.get(url).pipe(fs.createWriteStream(filePath));
}
} catch (err) {
console.error(err);
dialog.showMessageBox({

Loading…
Cancel
Save