Fix #621 - Always open external links externally (#622)

The tab feature introduced by #579 included a change that checks the `disposition` parameter and conditionally creates tabs, and that check was placed prior to the check to see if the URL is internal. This change moves the `linkIsInternal()` check earlier so that external links are always opened externally, regardless of disposition.
This commit is contained in:
David Kramer 2018-05-27 11:02:24 -07:00 committed by Ronan Jouchet
parent 587d615085
commit 1afc480923
1 changed files with 8 additions and 13 deletions

View File

@ -217,22 +217,17 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
event.newGuest = newGuest;
}
};
if (nativeTabsSupported()) {
if (disposition === 'background-tab') {
const newTab = createNewTab(urlToGo, false);
preventDefault(newTab);
return;
} else if (disposition === 'foreground-tab') {
const newTab = createNewTab(urlToGo, true);
preventDefault(newTab);
return;
}
}
if (!linkIsInternal(options.targetUrl, urlToGo, options.internalUrls)) {
shell.openExternal(urlToGo);
preventDefault();
// eslint-disable-next-line no-useless-return
return;
} else if (nativeTabsSupported()) {
if (disposition === 'background-tab') {
const newTab = createNewTab(urlToGo, false);
preventDefault(newTab);
} else if (disposition === 'foreground-tab') {
const newTab = createNewTab(urlToGo, true);
preventDefault(newTab);
}
}
};