1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red
Alexandre Alapetite e55cbb3e3d
Fix bug in debug node due to msg.hasOwnProperty construct
`msg.hasOwnProperty("status")` might make the debug node crash/produce an error if the payload was created with `Object.create(null)`.
This is the case e.g. for `ini` (to parse INI files), an official NPM node:
4f289946b3/lib/ini.js (L63)

My Node-RED node `node-red-contrib-parser-ini`, which is using that library, was hit by this bug and I had to ship a workaround
fe6b1eb4b1/parser-ini.js (L14)

The `msg.hasOwnProperty("xxx")` construct should not be used since ECMAScript 5.1.

ESLint advises in the same direction https://eslint.org/docs/rules/no-prototype-builtins

This patch was produced using the following regex:
Search: `\b([\w.]+).hasOwnProperty\(`
Replace: `Object.prototype.hasOwnProperty.call($1, `

This could be applied more gobally if desired.
2022-02-03 02:01:22 +01:00
..
editor-api Update package readmes and licenses 2022-01-27 12:49:48 +00:00
editor-client Update package readmes and licenses 2022-01-27 12:49:48 +00:00
nodes Fix bug in debug node due to msg.hasOwnProperty construct 2022-02-03 02:01:22 +01:00
registry Update package readmes and licenses 2022-01-27 12:49:48 +00:00
runtime Update package readmes and licenses 2022-01-27 12:49:48 +00:00
util Update package readmes and licenses 2022-01-27 12:49:48 +00:00