Show only save file dialog when clicking public file link

For #390
This commit is contained in:
Yuya Ochiai
2017-04-27 22:45:32 +09:00
parent 43725f42ff
commit 95c574eadc
3 changed files with 68 additions and 2 deletions

View File

@@ -64,9 +64,14 @@ const MattermostView = React.createClass({
ipcRenderer.send('confirm-protocol', destURL.protocol, e.url);
return;
}
if (currentURL.host === destURL.host) {
// New window should disable nodeIntergration.
window.open(e.url, 'Mattermost', 'nodeIntegration=no, show=yes');
if (destURL.path.match(/^\/api\/v[3-4]\/public\/files\//)) {
ipcRenderer.send('download-url', e.url);
} else {
// New window should disable nodeIntergration.
window.open(e.url, 'Mattermost', 'nodeIntegration=no, show=yes');
}
} else {
// if the link is external, use default browser.
shell.openExternal(e.url);