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

Handle cases where SVG content is a Blob #4063

Closed
wants to merge 1 commit into from
Closed

Handle cases where SVG content is a Blob #4063

wants to merge 1 commit into from

Conversation

heldersepu
Copy link
Contributor

Description

There are some rest API's that return the svg as a blob that will cause an error if we try ti render it directly

Types of changes

  • No code changes (changes to documentation, CI, metadata, etc)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@heldersepu heldersepu changed the title Handle cases where content is a Blob Handle cases where SVG content is a Blob Dec 31, 2017
@dirkschneemann
Copy link

When I try this out with my API returning an SVG image as blob, the returned image is not rendered, instead the following error box is shown with a "Plugin not supported" message when hovering over it. Same result in different browsers.

Can anybody else confirm this to be working?
svg

@shockey shockey added this to the January 26, 2018 milestone Jan 25, 2018
@shockey
Copy link
Contributor

shockey commented Jan 25, 2018

Travis appears to be in a bad state for this PR - going to close and reopen.

@shockey shockey closed this Jan 25, 2018
@heldersepu
Copy link
Contributor Author

heldersepu commented Jan 25, 2018

@shockey if you can (and only if you have time to spare) take a look at my code, see if there is any way to convert a blob to a string, I spent a lot of time on it and could not find any way...

@shockey
Copy link
Contributor

shockey commented Jan 25, 2018

@heldersepu, there is a way but it's pretty weird:

//// source: https://medium.com/programmers-developers/convert-blob-to-string-in-javascript-944c15ad7d52
const blb    = new Blob(["Lorem ipsum sit"], {type: "text/plain"});
const reader = new FileReader();

// This fires after the blob has been read/loaded.
reader.addEventListener('loadend', (e) => {
  const text = e.srcElement.result;
  console.log(text);
});

// Start reading the blob as text.
reader.readAsText(blb);

As for this PR, it looks like the source branch has vanished from your fork, so I can't reopen this - can you restore it and then open a new PR?

@heldersepu
Copy link
Contributor Author

Ye, I looked into that but it is async and I could not get it to work in a sync way...
The problem with my branch is that I deleted my fork and recreate it, this PR can stay close!

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