mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-01 12:53:49 +02:00
Fix some bugs & polish edge cases
This commit is contained in:
+7
-5
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user