dynamodb-toolbox
dynamodb-toolbox copied to clipboard
Fix crash due to string conversion of possible null prototype object
Fixes a bug that occurs when adding or updating an entity with an attribute that is an object with a null prototype.
Hopefully I understood the surrounding code correctly. If not, happy to update.
Updated.
Looks like a test is failing.
@dburdan @naorpeled change data[field] == null to data[field] === null (strict equality) then tests pass 😄
Any reason for moving this out to a separate variable (fieldIsNullOrEmpty) rather than keeping it inline?
@rbdmorgan Updated as suggested. IIRC codebase looked a bit different when the PR was made last year, but this should do.
Nice @dburdan 👍🏼
@jeremydaly @naorpeled possible to re-run tests and get this merged?
@rbdmorgan @dburdan will review this in a bit :)
Not 100% sure wether we want to remove the attribute if provided an empty array.
@jeremydaly wdyt?
Hey @dburdan, I've closed this PR because it would keep causing (the code already did that before, which wasn't right) the removal of empty arrays which is not a behavior I'd expect from removeNulls.
If you think otherwise let me know 🙏
@naorpeled Sounds good!