mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix: inline svg image taint canva
This commit is contained in:
parent
eeda86bd5e
commit
38ab9c192c
@ -94,7 +94,7 @@ export class Cache {
|
|||||||
img.onload = () => resolve(img);
|
img.onload = () => resolve(img);
|
||||||
img.onerror = reject;
|
img.onerror = reject;
|
||||||
//ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
|
//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.crossOrigin = 'anonymous';
|
||||||
}
|
}
|
||||||
img.src = src;
|
img.src = src;
|
||||||
@ -166,12 +166,10 @@ export class Cache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const INLINE_SVG = /^data:image\/svg\+xml/i;
|
const INLINE_SVG = /^data:image\/svg\+xml/i;
|
||||||
const INLINE_BASE64 = /^data:image\/.*;base64,/i;
|
|
||||||
const INLINE_IMG = /^data:image\/.*/i;
|
const INLINE_IMG = /^data:image\/.*/i;
|
||||||
|
|
||||||
const isRenderable = (src: string): boolean => FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);
|
const isRenderable = (src: string): boolean => FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);
|
||||||
const isInlineImage = (src: string): boolean => INLINE_IMG.test(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 isBlobImage = (src: string): boolean => src.substr(0, 4) === 'blob';
|
||||||
|
|
||||||
const isSVG = (src: string): boolean => src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
|
const isSVG = (src: string): boolean => src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
|
||||||
|
Loading…
Reference in New Issue
Block a user