You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many places, but particularly painful with setting clock mode, you can't set a parameter to 0 after it has been set to non-zero. This is because values are incorrectly validated as having value using simple casting to boolean. The issue is that 0 casts to false, yet it's a correct value for those parameters.
From my experience in old, low-level JS it seems like ! isNaN(parseInt(req.query.mode, 10)) could be enough. Maybe there are some smarter validators in NodeJS.
The text was updated successfully, but these errors were encountered:
In many places, but particularly painful with setting clock mode, you can't set a parameter to 0 after it has been set to non-zero. This is because values are incorrectly validated as having value using simple casting to boolean. The issue is that 0 casts to false, yet it's a correct value for those parameters.
For example, for the aforementioned clock mode:
https://github.com/jfroehlich/node-p1x3lramen/blob/main/source/service.js#L193C21-L193C21 we have
req.query.mode
which will yield false for 0 and thus not passingmode
parameter to https://github.com/jfroehlich/node-p1x3lramen/blob/main/source/devices/pixoo.js#L99From my experience in old, low-level JS it seems like
! isNaN(parseInt(req.query.mode, 10))
could be enough. Maybe there are some smarter validators in NodeJS.The text was updated successfully, but these errors were encountered: