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

fix: remove unnecessary check for response.buffer #2520

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/slimy-suns-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-pdf/image': patch
---

Remove unnecessary check for response.buffer
4 changes: 1 addition & 3 deletions packages/image/src/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ const fetchLocalFile = src =>
const fetchRemoteFile = async (uri, options) => {
const response = await fetch(uri, options);

const buffer = await (response.buffer
? response.buffer()
: response.arrayBuffer());
const buffer = await response.arrayBuffer();

return buffer.constructor.name === 'Buffer' ? buffer : Buffer.from(buffer);
};
Expand Down