mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Don't try to save files the user didn't want to save
Fixes https://github.com/vector-im/riot-web/issues/9350
This commit is contained in:
parent
95e247ae7c
commit
8b2d33ac0a
@ -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…
Reference in New Issue
Block a user