You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to upload a svg file to sanity using the "Upload assets" option, it fails to upload and throws this error in the console: Uncaught DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
I went through the node package, and modified the "createBlob" function inside /node_modules/sanity-plugin-media/dist/utils/generatePreviewBlobUrl.js, I added img.crossOrigin = "Anonymous"; to the image element being sent to the function and it works fine now, but I'm not sure if that's the right way of fixing this issue.
A change has since been made so errors in the preview image generation process won't impede the upload process. Whilst you won't see a preview image when uploading an SVG that contains foreign html elements, you should now be able to upload as normal.
Also worth mentioning that all SVGs uploaded to Sanity are automatically optimised and these elements will be stripped!
When I try to upload a svg file to sanity using the "Upload assets" option, it fails to upload and throws this error in the console:
Uncaught DOMException: Failed to execute 'toBlob' on 'HTMLCanvasElement': Tainted canvases may not be exported.
I went through the node package, and modified the "createBlob" function inside
/node_modules/sanity-plugin-media/dist/utils/generatePreviewBlobUrl.js
, I addedimg.crossOrigin = "Anonymous";
to the image element being sent to the function and it works fine now, but I'm not sure if that's the right way of fixing this issue.I include the svg file used for testing.
long_text.svg.zip
The text was updated successfully, but these errors were encountered: