FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix JS Image deserialization without data by xiaolu-ai26 · Pull Request #17 · onenodehq/onenode · GitHub

Fix JS Image deserialization without data - #17

Open
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:fix-js-image-deserialize-missing-data
Open

Fix JS Image deserialization without data#17
xiaolu-ai26 wants to merge 1 commit into
onenodehq:mainfrom
xiaolu-ai26:fix-js-image-deserialize-missing-data

Conversation

Copy link
Copy Markdown

Summary

Fixes #16.

Image._deserialize() now supports stored xImage objects that do not have data yet, such as pending image-processing documents or projected image metadata.

Changes

  • Allow the JS Image constructor to accept null as an internal no-data placeholder.
  • Store data as null for that placeholder and preserve the server-provided mime_type after deserialization.
  • Change _deserialize() from new Image(dataValue || "") to new Image(dataValue ?? null) so missing data does not become an invalid empty string.
  • Keep processed image URLs and binary inputs on the existing path.

Validation

  • Reproduced the current failure with an equivalent JS snippet: pending {xImage:{mime_type:"image/png", index:true}} reaches new Image("") and throws Invalid data.
  • Verified the fixed path deserializes both a pending image with no data and a processed image with URL/chunks.
deserialize missing-data PASS

Note

Full TypeScript build was not run locally because this environment does not have tsc or onenode-js/node_modules installed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS SDK Image deserialization fails when xImage data is missing

1 participant


Back | FazBrowse Home | New Git URL