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

Fixing Too many properties to enumerate on big XML documents #1147

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

tryggingamidstodin
Copy link
Contributor

This PR fixes an error when receiving a large XML document. When checking for the body length Object.keys is used causing the "Too many properties to enumerate" error for large XML documents.

When checking a length of buffer (when using raw body parser) you get the same results of

const buffer = Buffer.from('abc')
console.log(buffer.length) // 3
const buffer = Buffer.from('abc')
const keys = Object.keys(buffer)
console.log(keys.length) //3

When checking a length of a text (when using text body parser) you get the same results of

const txt = 'abc'
console.log(text.length) // 3
const text = 'abc'
const keys = Object.keys(buffer)
console.log(keys.length) //3

Except you won't reach the property limit of 65535](https://stackoverflow.com/a/9283945/5189472) for large documents. This PR solves that issue.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.068% when pulling 080cf06 on tryggingamidstodin:master into 95fa71f on vpulim:master.

@jsdevel jsdevel merged commit 290e3c1 into vpulim:master Jun 1, 2021
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.

4 participants