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

SVG images won't display after import of an OBZ board #765

Closed
martinbedouret opened this issue Aug 3, 2020 · 5 comments · Fixed by #776
Closed

SVG images won't display after import of an OBZ board #765

martinbedouret opened this issue Aug 3, 2020 · 5 comments · Fixed by #776
Assignees
Labels
Milestone

Comments

@martinbedouret
Copy link
Collaborator

martinbedouret commented Aug 3, 2020

  1. Import the attached board, it contains local images on PNG and SVG formats.
  2. Check the board on the Cboard ui
  3. SVG Image is lost

Coughdrop CommuniKate Action.zip

@sylvansson
Copy link
Collaborator

@martinbedouret Which image is missing specifically? I investigated and found that roughly 90% of SVG images in the attached OBZ file have an invalid MIME type (image/svg instead of image/svg+xml), so we construct an invalid data URI that the frontend cannot render.

// board_1_243.obf
{
  "id": "1_2931_15dbc4fe5664dd97760c86ed",
  "content_type": "image/svg", // should be `image/svg+xml`
  "path": "images/image_1_2931_15dbc4fe5664dd97760c86ed.svg"
}
// Template
data:<content-type>;base64;<encoded-image>
// Valid
data:image/svg+xml;base64,PD94b...
// Invalid
data:image/svg;base64,PD94b...

I think we could easily handle this by detecting the MIME type ourselves based on the filename using the mime-types library. However, I don't know whether we really want to support invalid configurations.

@martinbedouret
Copy link
Collaborator Author

@sylvansson yes, let's fix the MIME types if possible. The other issue I saw is that images are saving in cloud storage without file extension:

image

@sylvansson
Copy link
Collaborator

The simplest fix would be to replace image/svg with image/svg+xml when we encounter it, and eventually we could look into detecting the MIME type automatically as mentioned in #765 (comment).

Should we create a separate issue for the missing extension?

@martinbedouret
Copy link
Collaborator Author

yes let's handle the extension stuff as a separate issue.

@sylvansson
Copy link
Collaborator

Great. I should have a PR for this issue by Friday night.

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

Successfully merging a pull request may close this issue.

2 participants