fix: improve the performance of searching for auth tokens (#6717)

This commit is contained in:
Zoltan Kochan
2023-06-26 12:35:40 +03:00
committed by GitHub
parent 725c0d5adb
commit e44031e71c
2 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/network.auth-header": patch
"pnpm": patch
---
Improve the performance of searching for auth tokens.

View File

@@ -40,6 +40,6 @@ function getAuthHeaderByURI (authHeaders: Record<string, string>, maxParts: numb
function removePort (originalUrl: string) {
const urlObj = new URL(originalUrl)
if (urlObj.port === '') return originalUrl
const newUrlObj = new URL(`${urlObj.protocol}//${urlObj.hostname}${urlObj.pathname}${urlObj.search}${urlObj.hash}`)
return newUrlObj.toString()
urlObj.port = ''
return urlObj.toString()
}