patch: fixed open from browser on windows

Change-type: patch
Signed-off-by: Peter Makra <peter@balena.io>
This commit is contained in:
Peter Makra 2021-12-21 17:47:10 +01:00
parent b938132038
commit ef90d048ca

View File

@ -97,6 +97,7 @@ const sourceSelectorReady = new Promise((resolve) => {
async function selectImageURL(url?: string) { async function selectImageURL(url?: string) {
// 'data:,' is the default chromedriver url that is passed as last argument when running spectron tests // 'data:,' is the default chromedriver url that is passed as last argument when running spectron tests
if (url !== undefined && url !== 'data:,') { if (url !== undefined && url !== 'data:,') {
url = url.replace(/\/$/, ''); // on windows the url ends with an extra slash
url = url.startsWith(scheme) ? url.slice(scheme.length) : url; url = url.startsWith(scheme) ? url.slice(scheme.length) : url;
await sourceSelectorReady; await sourceSelectorReady;
electron.BrowserWindow.getAllWindows().forEach((window) => { electron.BrowserWindow.getAllWindows().forEach((window) => {