Skip to content

Commit

Permalink
Removed legacy node:url api
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Mar 19, 2024
1 parent 9f115af commit b65cc19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
18 changes: 8 additions & 10 deletions lib/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1216,12 +1216,11 @@ function sandBox(script, name, verbose, debug, context) {
} else if (options.bearerAuth) {
options.headers['Authorization'] = `Bearer ${options.bearerAuth}`;
} else {
const uri = new mods.url.parse(url);
if (uri.auth) {
const [username, password] = uri.auth.split(':');
const uri = new URL(url);
if (uri.username && uri.password) {
config.auth = {
username,
password,
username: uri.username,
password: uri.password,
};
}
}
Expand Down Expand Up @@ -1283,12 +1282,11 @@ function sandBox(script, name, verbose, debug, context) {
} else if (options.bearerAuth) {
options.headers['Authorization'] = `Bearer ${options.bearerAuth}`;
} else {
const uri = new mods.url.parse(url);
if (uri.auth) {
const [username, password] = uri.auth.split(':');
const uri = new URL(url);
if (uri.username && uri.password) {
config.auth = {
username,
password,
username: uri.username,
password: uri.password,
};
}
}
Expand Down
1 change: 0 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const mods = {
util: require('node:util'),
child_process: require('node:child_process'),
stream: require('node:stream'),
url: require('node:url'),
zlib: require('node:zlib'),
suncalc: require('suncalc2'),
axios: require('axios'),
Expand Down

0 comments on commit b65cc19

Please sign in to comment.