Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

fix: String not being base64 encoded #67

Merged
merged 2 commits into from
Jun 12, 2017

Conversation

tomcraven
Copy link
Contributor

Bugfix for strings not being base64 encoded. The specific issue is to do with happypack passing SVGs as strings instead of Buffers causes them to not be encoded properly.

@jsf-clabot
Copy link

jsf-clabot commented Mar 23, 2017

CLA assistant check
All committers have signed the CLA.

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Apr 9, 2017

@tomcraven Thx in advance 😛 Could you elaborate on this futher please, is this happypack specific or a general issue ? If in general I will include this fix in #70 or you rebase the PR after #70 lands

@tomcraven
Copy link
Contributor Author

hey @michael-ciniawsky thanks for the reply. The issue we were seeing is as follows:

  • we want to use happypack with SVGs and the url-loader
  • happypack passes the SVG content as a string to url-loader
  • url-loader calls toString("base64") on this string variable
  • calling toString("base64") on a string does not do any base64 conversion

So the issue seems specific to the happypack/url-loader interaction but, as with any untyped language, it would be great to be reactive to this way of passing in the SVG data

@michael-ciniawsky michael-ciniawsky changed the title Fix issue where string content would not be base64 encoded fix: String not being base64 encoded Jun 9, 2017
@michael-ciniawsky michael-ciniawsky added this to the 0.5.9 milestone Jun 9, 2017
@michael-ciniawsky
Copy link
Member

@tomcraven Could you please give a small code example just to clearify this definitely belongs here

@michael-ciniawsky michael-ciniawsky changed the title fix: String not being base64 encoded fix: String not being base64 encoded Jun 10, 2017
@tomcraven
Copy link
Contributor Author

hey @michael-ciniawsky, no problem. A little tricky to provide a code example that's small and also includes all the happypack/svg interaction. Here's a code example of what happens to the base64 encoding if the content is passed in as a string:

$ node
>
> "abc".toString("base64")
'abc'
> new Buffer("abc").toString("base64")
'YWJj'

No base 64 conversion happens on strings, it only happens if the object is a Buffer.

@michael-ciniawsky
Copy link
Member

@tomcraven Could you please quickly rebase ? :)

@tomcraven
Copy link
Contributor Author

hmm, that was my attempt at a rebase, let me know if you needed something else doing

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-ciniawsky michael-ciniawsky merged commit e9496b9 into webpack-contrib:master Jun 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants