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
I ran into a case where I passed an undefined value as part of my expression as */undefined * * * * and cron.validate() return true and find that it behave the same as a normal * * * * *
If I understand correctly, in this case the convertSteps function should receive 1,2,3,4,5,...,59/undefined which is not getting picked up by the ^(.+)\/(\d+)$ regex.
I ran into a case where I passed an
undefined
value as part of my expression as*/undefined * * * *
andcron.validate()
returntrue
and find that it behave the same as a normal* * * * *
If I understand correctly, in this case the
convertSteps
function should receive1,2,3,4,5,...,59/undefined
which is not getting picked up by the^(.+)\/(\d+)$
regex.node-cron/src/convert-expression/step-values-conversion.js
Lines 4 to 13 in 2a39703
Later it gets to the
normalizeIntegers
function and:parseInt('59/undefined')
=>59
Proposed Solution:
We can change the regex to
^(.+)\/(\w+)$
and check as early as possible ifisNaN(divider)
and throw an error in other cases.The text was updated successfully, but these errors were encountered: