handle multiple env vars (#3107)

Co-authored-by: ayadav16 <ayadav7@binghamton.edu>
This commit is contained in:
Apoorv Yadav 2024-09-15 15:54:51 -04:00 committed by GitHub
parent 6d239929da
commit 19501812fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,15 +42,15 @@ export const parsePathParams = (url) => {
uri = `http://${uri}`; uri = `http://${uri}`;
} }
let paths;
try { try {
uri = new URL(uri); uri = new URL(uri);
paths = uri.pathname.split('/');
} catch (e) { } catch (e) {
// URL is non-parsable, is it incomplete? Ignore. paths = uri.split('/');
return [];
} }
let paths = uri.pathname.split('/');
paths = paths.reduce((acc, path) => { paths = paths.reduce((acc, path) => {
if (path !== '' && path[0] === ':') { if (path !== '' && path[0] === ':') {
let name = path.slice(1, path.length); let name = path.slice(1, path.length);
@ -63,7 +63,6 @@ export const parsePathParams = (url) => {
} }
return acc; return acc;
}, []); }, []);
return paths; return paths;
}; };