From 38ab9c192ca70a998920bcc0708394d66d8eda04 Mon Sep 17 00:00:00 2001 From: emon100 Date: Mon, 23 Aug 2021 21:07:59 +0800 Subject: [PATCH] Fix: inline svg image taint canva --- src/core/cache-storage.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/cache-storage.ts b/src/core/cache-storage.ts index 2be98ed..687c832 100644 --- a/src/core/cache-storage.ts +++ b/src/core/cache-storage.ts @@ -94,7 +94,7 @@ export class Cache { img.onload = () => resolve(img); img.onerror = reject; //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous - if (isInlineBase64Image(src) || useCORS) { + if (isInlineImage(src) || useCORS) { img.crossOrigin = 'anonymous'; } img.src = src; @@ -166,12 +166,10 @@ export class Cache { } const INLINE_SVG = /^data:image\/svg\+xml/i; -const INLINE_BASE64 = /^data:image\/.*;base64,/i; const INLINE_IMG = /^data:image\/.*/i; const isRenderable = (src: string): boolean => FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src); const isInlineImage = (src: string): boolean => INLINE_IMG.test(src); -const isInlineBase64Image = (src: string): boolean => INLINE_BASE64.test(src); const isBlobImage = (src: string): boolean => src.substr(0, 4) === 'blob'; const isSVG = (src: string): boolean => src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);