Skip to content

Commit

Permalink
fix: parse cron components without panic (#1817)
Browse files Browse the repository at this point in the history
Fixes #1807

Was crashing when having random words in each component.
  • Loading branch information
gak authored Jun 18, 2024
1 parent c3c5c3d commit a279746
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/schema/metadatacronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
type MetadataCronJob struct {
Pos Position `parser:"" protobuf:"1,optional"`

Cron string `parser:"'+' 'cron' Whitespace @(' ' | ~EOL)*" protobuf:"2"`
Cron string `parser:"'+' 'cron' Whitespace @(' ' | ~EOL)+" protobuf:"2"`
}

var _ Metadata = (*MetadataCronJob)(nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/cron/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
type Pattern struct {
Duration *string `parser:"@(Number ('s' | 'm' | 'h'))"`
DayOfWeek *DayOfWeek `parser:"| @('Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' | 'Sun')"`
Components []Component `parser:"| @@*"`
Components []Component `parser:"| @@+"`
}

func (p Pattern) String() string {
Expand Down

0 comments on commit a279746

Please sign in to comment.