Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Invalid SVG Blob Formatting #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

taj-p
Copy link

@taj-p taj-p commented Mar 25, 2024

Intent

The extension is currently corrupting SVG type Blobs because of the monkeypatched Blob incorrectly injects the script tag into the resulting SVG.

We've found that our users cannot view SVGs on our website while ExpressVPN is enabled. This is a big problem for our site which depends on viewing and manipulating SVGs.

cc @expressvpn-andre-l / @expressvpn-tom-l

Before / After

You can see an example of how SVGs were encoded before these changes here.

  • The SVG is not properly rendered.

You can see an example of SVG rendering after these changes here.

  • The SVG is rendered 😄

Note: I quickly hacked together these changes. Please amend as you see fit!

@taj-p taj-p changed the title Fix Script Injection into SVGs Fix: Invalid SVG Blob Formatting Mar 25, 2024
@taj-p
Copy link
Author

taj-p commented Mar 26, 2024

cc @expressvpn-andre-l / @expressvpn-tom-l

SVGs are no longer rendering correctly for users of ExpressVPN who use www.canva.com - is there any chance you could expedite a hotfix 🙏 ?

This bugs prevents users from viewing SVGs rendered via URLs created from blobs as shown below:

        var blob = new Blob([svgData], { type: 'image/svg+xml' });
        var url = URL.createObjectURL(blob);

If there's anything I can do to help, please let me know!

@xv-bruno-m
Copy link
Collaborator

xv-bruno-m commented Mar 28, 2024

Hey @taj-p

Thanks for raising this. We have just allocated time to fix it and will start working on it very soon.
Just to clarify something, the problem happens on all SVGs rendered in canva.com, not just when the user exports them, correct? Can you provide a step-by-step on how to encounter this issue in canva.com?

Thank you

@taj-p
Copy link
Author

taj-p commented Apr 1, 2024

Thanks @xv-bruno-m - Yeah of course! Sorry it took me so long - I needed to open an account. You should be able to view this design. It should look like this:

image

Instead, with ExpressVPN on, you see this:

image

(We catch the error and show the user a fallback image since the SVG becomes invalid)

@taj-p
Copy link
Author

taj-p commented Apr 22, 2024

bump @xv-bruno-m - have you had a chance to work on this?

@xv-bruno-m
Copy link
Collaborator

bump @xv-bruno-m - have you had a chance to work on this?

Haven't had a chance yet but it has been prioritized. I believe we may be able to ship a fix in 2 weeks or so.

@xv-bruno-m
Copy link
Collaborator

Hey @taj-p

We will start the rollout of the build that includes a fix for this issue - v6.0.4.6091
Let me know when you get it and confirm it fixes it. Thanks again for your report and suggested fix!

Cheers

@taj-p
Copy link
Author

taj-p commented May 10, 2024

Hey @taj-p

We will start the rollout of the build that includes a fix for this issue - v6.0.4.6091
Let me know when you get it and confirm it fixes it. Thanks again for your report and suggested fix!

Cheers

Nice thank you! 🙏🥳

@ethan-canva
Copy link

ethan-canva commented Jun 14, 2024

👋 @xv-bruno-m, (same from Canva) we are experiencing the same problem when building our MPEG-DASH manifest (For adaptive video playback).

   // sample code
    const xml = new Blob([manifest], { type: 'text/xml' });
    const url = URL.createObjectURL(xml);

It breaks at the same line of code in gps.js with an error

"Failed to execute 'insertAdjacentHTML' on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document."

cc: @expressvpn-andre-l

Please advise

@xv-bruno-m
Copy link
Collaborator

Hey

Could you please make a codepen/jsbin with the code that breaks it?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants