Fix external SVG loading with proxies (#802)

This commit is contained in:
Niklas von Hertzen
2017-12-11 20:51:20 +08:00
parent d87fef11a4
commit 50608e9cd4
6 changed files with 11 additions and 10 deletions

View File

@ -177,6 +177,7 @@ export class DocumentCloner {
backgroundColor: '#ffffff',
canvas: null,
imageTimeout: this.options.imageTimeout,
logging: this.options.logging,
proxy: this.options.proxy,
removeContainer: this.options.removeContainer,
scale: this.options.scale,

View File

@ -34,16 +34,8 @@ export default class ResourceLoader {
return src;
}
if (isSVG(src)) {
if (this.options.allowTaint === true || FEATURES.SUPPORT_SVG_DRAWING) {
return this.addImage(src, src, false);
}
} else {
if (
this.options.allowTaint === true ||
isInlineBase64Image(src) ||
this.isSameOrigin(src)
) {
if (!isSVG(src) || FEATURES.SUPPORT_SVG_DRAWING) {
if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {
return this.addImage(src, src, false);
} else if (!this.isSameOrigin(src)) {
if (typeof this.options.proxy === 'string') {

View File

@ -65,6 +65,7 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
async: true,
allowTaint: false,
imageTimeout: 15000,
logging: true,
proxy: null,
removeContainer: true,
foreignObjectRendering: false,