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

Added Array.isArray check during redaction #83

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Added Array.isArray check during redaction #83

merged 1 commit into from
Feb 22, 2024

Conversation

ezimuel
Copy link
Contributor

@ezimuel ezimuel commented Feb 12, 2024

This PR fixes elastic/elasticsearch-js#2128 issue. The issue was related to the conversion of property array into object due to this check:

if (typeof value === 'object' && value !== null) {
  // ...
}

Since typeof of an Array is an object in Javascript (see here) the solution for removing Array in this condition is to use Array.isArray(), as follows:

if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
  // ..
}

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

@ezimuel ezimuel merged commit 298c9e9 into main Feb 22, 2024
14 checks passed
@JoshMock JoshMock deleted the fix/redaction branch February 23, 2024 17:38
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.

Redaction mechanism transform arrays properties into objects
2 participants