Skip to content

Conversation

@zsviczian
Copy link
Collaborator

addresses: #8472

@vercel
Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
excalidraw ✅ Ready (Inspect) Visit Preview Sep 12, 2024 1:47pm
excalidraw-package-example ✅ Ready (Inspect) Visit Preview Sep 12, 2024 1:47pm
excalidraw-package-example-with-nextjs ✅ Ready (Inspect) Visit Preview Sep 12, 2024 1:47pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Sep 12, 2024 1:47pm

@github-actions
Copy link

github-actions bot commented Sep 6, 2024

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 66.71% (🎯 66%) 62814 / 94158
🟢 Statements 66.71% (🎯 66%) 62814 / 94158
🟢 Functions 63.85% (🎯 63%) 1874 / 2935
🟢 Branches 79.89% (🎯 70%) 7664 / 9592
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/excalidraw/data/encode.ts 50.75% 54.54% 50% 50.75% 15, 20-21, 61-67, 98-99, 106-107, 117-118, 120, 128-130, 175-193, 212-238, 242-277, 284-293, 309-340, 344-358, 361-398
packages/excalidraw/fonts/ExcalidrawFont.ts 76.16% 60% 100% 76.16% 17, 56-64, 82-102, 129-132, 142-143, 170-174, 187-188, 192-193, 203-207
Generated in workflow #3302

return Buffer.from(base64String, "base64").buffer;
}
// Browser environment
return base64ToArrayBuffer(base64String);
Copy link
Member

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

Copy link
Collaborator Author

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

@zsviczian
Copy link
Collaborator Author

Ok. I've implemented the recommended changes.

@dwelle
Copy link
Member

dwelle commented Sep 12, 2024

@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 URL object, and double stringifying).

1dbe200 (#8474)

If it looks good, you can merge!

@zsviczian zsviczian merged commit c1b310c into master Sep 12, 2024
@zsviczian zsviczian deleted the zsviczian-fix-Buffer branch September 12, 2024 13:48
Mrazator pushed a commit to dwelle/excalidraw that referenced this pull request Sep 20, 2024
* fix Buffer dependency

* moved to encode.ts

* move base64 parsing out

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
Mrazator pushed a commit that referenced this pull request Sep 24, 2024
* fix Buffer dependency

* moved to encode.ts

* move base64 parsing out

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
Mrazator pushed a commit to dwelle/excalidraw that referenced this pull request Sep 25, 2024
* fix Buffer dependency

* moved to encode.ts

* move base64 parsing out

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
clarencechaan pushed a commit to clarencechaan/excalidraw that referenced this pull request Oct 3, 2024
* fix Buffer dependency

* moved to encode.ts

* move base64 parsing out

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
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.

3 participants