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

toDataURL incorrectly contains line breaks #1986

Closed
robrechtme opened this issue Feb 14, 2023 · 2 comments · Fixed by #2272
Closed

toDataURL incorrectly contains line breaks #1986

robrechtme opened this issue Feb 14, 2023 · 2 comments · Fixed by #2272

Comments

@robrechtme
Copy link

Bug

The toDataURL method contains line breaks \r\n, which break the base64 string.

Unexpected behavior

This can lead to corrupted images when e.g. using it in react-native-share.

Environment info

Library version: 13.4.0

Short, Self Contained, Correct (Compilable), Example

https://snack.expo.dev/@robrechtme/data-url-bug

@blnaxblachbl
Copy link

Yes, i notice it too, and it happened only on IOS. i just remove it from base64 string:

base64String.replace(/\r?\n|\r/g, '')

hope it will be fixed

@jakex7
Copy link
Member

jakex7 commented May 13, 2024

Hi! Could you check if #2272 resolves the issue?

jakex7 added a commit that referenced this issue May 15, 2024
# Summary

This PR removes the flag to include custom line breaks on `toDataUrl`
method. Some software could not read base64 with additional line break
characters, so it could lead to corrupting the image (like in
react-native-share). Fixes #1986.

## Test Plan

`TestsExample` -> `Test1986`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |    ✅     |
| Android |    ✅     |
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 a pull request may close this issue.

3 participants