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 conversion of Uint8Array to object (#761) #762

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Maia-Everett
Copy link

As said in #761, node-config handles TypedArray values (including Uint8Array) incorrectly, wrapping them in proxy objects that are not accepted by anything that expects a real TypedArray (e.g. Buffer.from()).

I hit this bug with js-yaml 4.x, which made a breaking change compared to js-yaml 3.x, returning Uint8Array for !!binary values rather than returning Buffer like 3.x did.

This PR:

  • Makes makeImmutable() ignore TypedArray and DataView values (leaving them mutable, as there's no way to make them immutable)
  • Makes cloneDeep() correctly clone TypedArray and DataView values
  • Bumps the js-yaml dev dependency to the latest version 4.1.0, which hits the bug in node-config
  • Adds a test for the bug fixed

Copy link
Collaborator

@markstos markstos left a comment

Choose a reason for hiding this comment

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

LGTM.

@markstos
Copy link
Collaborator

@lorenwest This PR seems consistent with some other special cases we handle and includes test coverage. I recommend merging it.

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