Skip to content

Commit

Permalink
Open urls even if they don't start with http
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomgcd committed Jul 14, 2021
1 parent 59ecd35 commit 2345c86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/serverutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export class UtilServer{
if(needsFilePrefix){
urlOrFile = `file://${urlOrFile}`
}
if(!urlOrFile.includes("://")){
urlOrFile = `https://${urlOrFile}`;
}
console.log("Opening url or file",urlOrFile)
shell.openExternal(urlOrFile);
}
Expand Down
4 changes: 4 additions & 0 deletions v2/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class Util{
})();
}
static async openWindow(url,options){
if(!url) return;
if(!url.includes("://")){
url = `https://${url}`;
}
if(!Util.isInServiceWorker){
//If URL is http we can't download because we're https and Chrome doesn't allow it.
if(url.startsWith("http:")){
Expand Down

0 comments on commit 2345c86

Please sign in to comment.