Add return error when list object (#4753)

This commit is contained in:
Milos Gajdos
2026-01-05 06:47:03 -08:00
committed by GitHub

View File

@@ -1013,11 +1013,13 @@ func (d *driver) Delete(ctx context.Context, path string) error {
for {
// list all the objects
resp, err := d.S3.ListObjectsV2WithContext(ctx, listObjectsInput)
if err != nil {
return err
}
// resp.Contents can only be empty on the first call
// if there were no more results to return after the first call, resp.IsTruncated would have been false
// and the loop would exit without recalling ListObjects
if err != nil || len(resp.Contents) == 0 {
if len(resp.Contents) == 0 {
return storagedriver.PathNotFoundError{Path: path}
}