s3Storage: fix slice bounds out of range error (#3208)

This commit is contained in:
John Regan 2023-07-24 18:12:04 -04:00 committed by GitHub
parent c90929b544
commit b2a80f2149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,9 @@ func (s *S3Storage) Cleanup() error {
return err
}
s.deleteObjects(keys)
if len(keys) > 0 {
s.deleteObjects(keys)
}
return nil
}
@ -241,6 +243,10 @@ func (s *S3Storage) getDeletableVideoSegmentsWithOffset(offset int) ([]s3object,
return nil, err
}
if offset > len(objectsToDelete)-1 {
offset = len(objectsToDelete) - 1
}
objectsToDelete = objectsToDelete[offset : len(objectsToDelete)-1]
return objectsToDelete, nil