From 656675c1947d149a6a3a12fa40891902ecc8fac6 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Thu, 27 Aug 2026 20:42:27 +0300 Subject: [PATCH] Validate natural interval steps in the correct clock fields --- lib/fugit/nat.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/fugit/nat.rb b/lib/fugit/nat.rb index 0b0969f..0a683b0 100644 --- a/lib/fugit/nat.rb +++ b/lib/fugit/nat.rb @@ -743,7 +743,7 @@ def parse_cron(hm, opts) c = Fugit::Cron.parse(s, opts) if opts[:strict] - restrict(a, c) + restrict(hm, c) else c end @@ -761,11 +761,11 @@ def parse_cron(hm, opts) # def restrict(a, cron) - if m = ((a[0] && a[0] != [ 0 ] && a[0][0]) || '').match(SLASH_REGEX) - return nil unless (1..60).include?(m[1].to_i) + if m = a[1].first.to_s.match(SLASH_REGEX) + return nil unless (1..60).include?(m[2].to_i) end - if m = ((a[1] && a[1][0]) || '').match(SLASH_REGEX) - return nil unless [ 1, 2, 3, 4, 5, 6, 8, 12 ].include?(m[1].to_i) + if m = a[0].first.to_s.match(SLASH_REGEX) + return nil unless [ 1, 2, 3, 4, 5, 6, 8, 12 ].include?(m[2].to_i) end cron