Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

storage: ignore key not found error when deleting files #83

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion storage/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"strings"

"github.com/minio/minio-go/v7"
)
Expand Down Expand Up @@ -97,7 +98,10 @@ func (m *MinioClient) DeleteObjects(ctx context.Context, i DeleteObjectsInput) e
job := func(ctx context.Context) error {
// we can't use RemoveObjects, because gcp doesn't support batch delete
if err := m.cli.RemoveObject(ctx, i.Bucket, key, minio.RemoveObjectOptions{}); err != nil {
return fmt.Errorf("storage: %s delete prefix remove key: %s %w", m.provider, key, err)
if !strings.Contains(err.Error(), "The specified key does not exist") {
// if key not exist, we can ignore it
return fmt.Errorf("storage: %s delete prefix remove key: %s %w", m.provider, key, err)
}
}

return nil
Expand Down
Loading