Fix some bugs & polish edge cases

This commit is contained in:
Vanilagy
2026-05-11 23:50:06 +02:00
parent d8c8606341
commit 81531cc510
8 changed files with 92 additions and 28 deletions
+7 -5
View File
@@ -591,11 +591,13 @@ const DEFAULT_RETRY_DELAY
// Check if this could be a CORS error. If so, we cannot recover from it and
// should not attempt to retry.
// CORS errors are intentionally not opaque, so we need to rely on heuristics.
const couldBeCorsError = error instanceof Error && (
error.message.includes('Failed to fetch') // Chrome
|| error.message.includes('Load failed') // Safari
|| error.message.includes('NetworkError when attempting to fetch resource') // Firefox
);
const couldBeCorsError = error instanceof Error
&& (
error.message.includes('Failed to fetch') // Chrome
|| error.message.includes('Load failed') // Safari
|| error.message.includes('NetworkError when attempting to fetch resource') // Firefox
)
&& typeof window !== 'undefined'; // CORS only happens in browser environments
if (couldBeCorsError) {
let originOfSrc: string | null = null;