-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
fix: Buffer dependency #8474
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
fix: Buffer dependency #8474
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
packages/excalidraw/utils.ts
Outdated
| return Buffer.from(base64String, "base64").buffer; | ||
| } | ||
| // Browser environment | ||
| return base64ToArrayBuffer(base64String); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we reuse our byteStringToArrayBuffer() here?
So:
byteStringToArrayBuffer(atob(base64))
Let's also rename the helper to base64ToArrayBuffer to more or less align with our other serde helpers, and put into packages/excalidraw/data/encode.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not find byteStringToArrayBuffer...
I've applied the changes
|
Ok. I've implemented the recommended changes. |
|
@zsviczian I've moved the parsing of base64 out of the helper as that helper should already accept base64 string, not url (also, you were already passing a dataURL, not If it looks good, you can merge! |
* fix Buffer dependency * moved to encode.ts * move base64 parsing out --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix Buffer dependency * moved to encode.ts * move base64 parsing out --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix Buffer dependency * moved to encode.ts * move base64 parsing out --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
* fix Buffer dependency * moved to encode.ts * move base64 parsing out --------- Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
addresses: #8472