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

Fixed issue with converting ArrayBuffer to base64 #154

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

vongrad
Copy link
Contributor

@vongrad vongrad commented Mar 3, 2023

There seems to be an issue with generating Epub with inline images using the following command:
percollate epub --inline https://da.m.wikipedia.org/wiki/Danmarks_historie

The function fetchBase64 does not properly convert the ArrayBuffer to base64 string and instead produces [object ArrayBuffer].
Example of the output:
<img data-file-height="355" data-file-width="330" decoding="async" src="data:image/png;base64,[object ArrayBuffer]" />

I have included a small patch that should fix this issue.

@danburzo
Copy link
Owner

danburzo commented Mar 3, 2023

Great catch, @vongrad! I carelessly replaced the buffer() deprecated call with arrayBuffer() and forgot about the serialization. Although not strictly necessary, could you please also import Buffer from node:buffer?

@vongrad
Copy link
Contributor Author

vongrad commented Mar 3, 2023

Sure thing, it's imported now.

@danburzo
Copy link
Owner

danburzo commented Mar 3, 2023

Perfect, thank you for the fix!

@danburzo danburzo merged commit 1d1e54e into danburzo:main Mar 3, 2023
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

2 participants