bugfix: Ensure proper handling of empty metafile buffers#4418
Closed
Garefild wants to merge 1 commit intoevanw:mainfrom
Closed
bugfix: Ensure proper handling of empty metafile buffers#4418Garefild wants to merge 1 commit intoevanw:mainfrom
Garefild wants to merge 1 commit intoevanw:mainfrom
Conversation
Garefild
added a commit
to remotex-labs/xBuild
that referenced
this pull request
Mar 15, 2026
`Handle empty Uint8Array in parseJSON()` evanw/esbuild#4418
|
downgrading to 0.27.3 worked for me |
Author
Yes, that does work, but I prefer to stay in sync with the latest releases. From what I can tell, the issue is caused by the js api: fall back to js-based metafile json parser The fix itself should be relatively straightforward. I’ve submitted a patch and am currently waiting for review. |
This was referenced Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Handle empty
Uint8ArrayinparseJSON()Backport → 0.27.4
Problem
When an optional JSON field was sent as an empty buffer,
parseJSON()would decode theUint8Array(0)into an empty string and pass it straight toJSON.parse("")— which unconditionally throws:Solution
parseJSON()now short-circuits on empty input, returningundefinedbefore any decoding or parsing occurs. As a related change,parseJSON()is no longer called for an empty metafile buffer —result.metafilestaysundefinedwhen no metafile payload is present.Fixes #4420.