pull/32621/merge
Zhao Jianing 2 days ago committed by GitHub
commit 3d366020bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,6 +17,7 @@ limitations under the License.
package action
import (
"errors"
"path"
"regexp"
@ -151,6 +152,12 @@ func (l *List) Run() ([]ri.Releaser, error) {
return nil, err
}
// A negative offset would otherwise panic in the slice expression below,
// as the out-of-bounds guard only covers offsets past the end of the list.
if l.Offset < 0 {
return nil, errors.New("list offset cannot be negative")
}
var filter *regexp.Regexp
if l.Filter != "" {
var err error

@ -179,6 +179,15 @@ func TestList_LimitOffsetOutOfBounds(t *testing.T) {
is.Len(list, 2)
}
func TestList_NegativeOffset(t *testing.T) {
req := require.New(t)
lister := newListFixture(t)
lister.Offset = -1
makeMeSomeReleases(t, lister.cfg.Releases)
_, err := lister.Run()
req.Error(err)
}
func TestList_StateMask(t *testing.T) {
is := assert.New(t)
req := require.New(t)

Loading…
Cancel
Save