From 024f50531ac745174bf07ba81cfb1769b65f337e Mon Sep 17 00:00:00 2001 From: Elbert Alias <77259+AliasIO@users.noreply.github.com> Date: Tue, 24 Jan 2023 08:18:57 +1100 Subject: [PATCH] Allow up to 3 redirects --- src/drivers/npm/driver.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/drivers/npm/driver.js b/src/drivers/npm/driver.js index f51d288df..2ff328d06 100644 --- a/src/drivers/npm/driver.js +++ b/src/drivers/npm/driver.js @@ -684,11 +684,12 @@ class Site { if (headers.location) { const _url = new URL(headers.location.slice(-1), url) + const redirects = Object.keys(this.analyzedUrls).length - 1 + if ( _url.hostname.replace(/^www\./, '') === this.originalUrl.hostname.replace(/^www\./, '') || - (Object.keys(this.analyzedUrls).length === 1 && - !this.options.noRedirect) + (redirects < 3 && !this.options.noRedirect) ) { url = _url