fix(browser): follow only HTTP redirect statuses for source maps

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Celekli
2026-10-10 01:45:00 +08:00
committed by morluto
parent f166a2ae15
commit 82bbe74333
2 changed files with 92 additions and 1 deletions
+3 -1
View File
@@ -289,7 +289,9 @@ const fetchFollowingApprovedRedirects = async (
await response.body?.cancel(signal.reason).catch(() => undefined);
throw signal.reason;
}
if (response.status < 300 || response.status >= 400)
// Location is a redirect target only for the Fetch redirect statuses.
// A 304 or another 3xx response must retain its own HTTP failure.
if (![301, 302, 303, 307, 308].includes(response.status))
return { response, fetchedUrl: current };
const location = response.headers.get("location");
if (location === null) return { response, fetchedUrl: current };