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 file stream consumption when buffer has not loaded yet #461

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

andersonjoseph
Copy link
Contributor

Checklist


Hey! This PR fixes #369

Seems like _buf is initialized with null and its data is being loaded through part.toBuffer(). The condition that checks if the field has data in its buffer compares only against undefined instead of null, leading to an exception when calling field._buf.toString() when _buf === null.

Let me know if I'm missing something or if something needs to be changed.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 8096bc5 into fastify:master Jul 21, 2023
15 checks passed
@andersonjoseph andersonjoseph deleted the fix-null-buf branch July 21, 2023 14:44
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.

setting onFile callback makes field._buf === null
2 participants