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

Bug fixes of encoding png image in url lib function #2549

Merged
merged 1 commit into from Aug 18, 2020
Merged

Conversation

mockee
Copy link
Contributor

@mockee mockee commented Aug 4, 2020

These changes breaks the base64 encoding of png images.

Related PR and discussion: #2546 (comment)


1x1px png for testing: http://1x1px.me/000000-0.8.png

stylus 0.54.8

got the wrong result:

data:image/png;base64,77+9UE5HChoKAAAACklIRFIAAAABAAAAAQgEAAAA77+9HAwCAAAAC0lEQVR477+9Y2I4AwAA77+9AM+Z77+9TlUAAAAASUVORO+/vUJg77+9

Buffer.from(buf.toString().replace(/\r\n?/g, '\n'))):

<Buffer ef bf bd 50 4e 47 0a 1a 0a 00 00 00 0a 49 48 44 52 00 00 00 01 00 00 00 01 08 04 00 00 00 ef bf bd 1c 0c 02 00 00 00 0b 49 44 41 54 78 ef bf bd 63 62 ... 31 more bytes>

stylus 0.54.7 or include this PR

got the correct result:

base64:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNiOAMAANUAz5n+TlUAAAAASUVORK5CYII=

buf:

<Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 01 00 00 00 01 08 04 00 00 00 b5 1c 0c 02 00 00 00 0b 49 44 41 54 78 9c 63 62 38 03 00 00 d5 ... 18 more bytes>

@xdan xdan merged commit 59bc665 into stylus:dev Aug 18, 2020
rlidwka added a commit to nodeca/ndoc that referenced this pull request Nov 17, 2020
0.54.8 has an issue (fixed, but not released yet):
stylus/stylus#2549
@rlidwka
Copy link

rlidwka commented Nov 18, 2020

Can you release a new version with this fix please?

cc: @xdan

@iChenLei
Copy link
Member

iChenLei commented Sep 4, 2021

@rlidwka release v0.55.0 just now.

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.

None yet

5 participants