cronexpr icon indicating copy to clipboard operation
cronexpr copied to clipboard

Expose ParseStrict to error on too many fields

Open krallin opened this issue 7 years ago • 0 comments

Parse currently ignores any tokens after the 7th, which means invalid cron expressions might be allowed as long as invalid tokens are found after the 7th character.

In some use cases (e.g. validating cron expressions provided by a user), this might not be desirable. To allow for this use case, this adds a ParseStrict function that returns an error if too many fields are provided (it retains backwards compatibility by not touching Parse).


For some context, here's where I ran into this and could use a ParseStrict :smile: : https://github.com/aptible/supercronic/pull/34

Thanks!

krallin avatar Aug 01 '18 14:08 krallin