Skip to content

Commit 15dd221

Browse files
authored
fix: clean password by using url object itself (#178)
* rebuild the url instead of replacing the password * Fix issues perventing the tests from passing
1 parent 71d8f72 commit 15dd221

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/clean-url.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const cleanUrl = (str) => {
1212
try {
1313
const url = new URL(str)
1414
if (url.password) {
15-
str = str.replace(url.password, replace)
15+
url.password = replace
16+
str = url.toString()
1617
}
1718
} catch {
1819
// ignore errors

0 commit comments

Comments
 (0)