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

XMLHttpRequest for image data should also check for status code 0 #196

Open
2 tasks done
austinkkoehler opened this issue Oct 23, 2024 · 0 comments
Open
2 tasks done

Comments

@austinkkoehler
Copy link

austinkkoehler commented Oct 23, 2024

Use case: description, code

When retrieving image data, dom-to-image-more checks for a status code of >=300 as a generic catch-all for errors.

The library fails when there is something that returns a status of 0, such as DNS or CORS rejection errors (among a few other things, see the answers here: https://stackoverflow.com/questions/2000609/why-is-ajax-returning-http-status-code-0).

I'm unable to provide a fix myself.

Expected behavior

XMLHttpRequest accounts for 0 as it does >=300: be considered a failure, but allow SVG conversion to continue.

Actual behavior (stack traces, console logs etc)

The request is treated as a success, so readAsDataURL fails because it attempts to operate on a null response. This is viewable through the browser's error logs.

Library version

3.4.5

Browsers

  • Chrome 49+
  • Firefox 45+
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

No branches or pull requests

1 participant