Skip to content

Commit

Permalink
handleURL: Resolve host for undefined or null string
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 21, 2023
1 parent 90245a9 commit 6364ce1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion electron/url-handle/handleURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ const filterPaths = list => {
return filteredList;
};

const resolveHost = (host) => (
!host || host === 'undefined' || host === 'null' ? 'localhost' : host
);

export const parseUrl = _url => {
const route = url.parse(_url);
if (route.host !== 'set-debugger-loc') return;
const { host, port, projectRoots } = qs.parse(route.query);
const query = {
host: host || 'localhost',
host: resolveHost(host),
port: Number(port) || 8081,
projectRoots: Array.isArray(projectRoots) ? filterPaths(projectRoots.split(',')) : undefined,
};
Expand Down

0 comments on commit 6364ce1

Please sign in to comment.