Merge pull request #519 from yuya-oc/download-public-file

Don't show an extra window when clicking public file link
This commit is contained in:
Yuya Ochiai
2017-04-28 21:16:42 +09:00
committed by GitHub
4 changed files with 74 additions and 2 deletions

View File

@@ -66,9 +66,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);