diff --git a/tools/rest/excerpt_modifier.go b/tools/rest/excerpt_modifier.go index 07da1a06..b1ba3ee1 100644 --- a/tools/rest/excerpt_modifier.go +++ b/tools/rest/excerpt_modifier.go @@ -47,7 +47,7 @@ func newExcerptModifier(args ...string) (*excerptModifier, error) { } max := cast.ToInt(args[0]) - if max == 0 { + if max <= 0 { return nil, errors.New("max argument must be > 0") } diff --git a/tools/rest/excerpt_modifier_test.go b/tools/rest/excerpt_modifier_test.go index 47a87a66..a8078f9a 100644 --- a/tools/rest/excerpt_modifier_test.go +++ b/tools/rest/excerpt_modifier_test.go @@ -28,6 +28,16 @@ func TestNewExcerptModifier(t *testing.T) { []string{"something"}, // should fallback to 0 which is not allowed true, }, + { + "negative numeric max argument", + []string{"-1"}, + true, + }, + { + "zero numeric max argument", + []string{"0"}, + true, + }, { "numeric max argument", []string{"12"},