From ba9c3f003488221a7e37a28c7a9626a2936dba2b Mon Sep 17 00:00:00 2001 From: Marc G Date: Thu, 5 Oct 2023 08:09:30 -0400 Subject: [PATCH] fix: switched stripUrlAuth to a regex --- src/utils/stripUrlAuth.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/utils/stripUrlAuth.js b/src/utils/stripUrlAuth.js index 4406da81e..8912cdc96 100644 --- a/src/utils/stripUrlAuth.js +++ b/src/utils/stripUrlAuth.js @@ -1,10 +1,9 @@ 'use strict' -const normalizeUrl = require('normalize-url') +module.exports = (url) => { + if (typeof url !== 'string') { + throw new TypeError('Expected a valid URL') + } -module.exports = (url) => normalizeUrl(url, { - normalizeProtocol: false, - stripWWW: false, - removeTrailingSlash: false, - sortQueryParameters: false, -}) \ No newline at end of file + return url.replace(/^((?:\w+:)?\/\/)[^@/]+@/, '$1') +} \ No newline at end of file