From 15dd2216a52393fbce2246c071045c6597c922ea Mon Sep 17 00:00:00 2001 From: Mohamed Dief Date: Thu, 13 Apr 2023 08:59:42 -0700 Subject: [PATCH] fix: clean password by using url object itself (#178) * rebuild the url instead of replacing the password * Fix issues perventing the tests from passing --- lib/clean-url.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/clean-url.js b/lib/clean-url.js index a419b47d..0c2656b5 100644 --- a/lib/clean-url.js +++ b/lib/clean-url.js @@ -12,7 +12,8 @@ const cleanUrl = (str) => { try { const url = new URL(str) if (url.password) { - str = str.replace(url.password, replace) + url.password = replace + str = url.toString() } } catch { // ignore errors