fix: Error handling for posix DeleteObject function to return an error when the object doesn't exist

This commit is contained in:
jonaustin09
2023-07-14 23:41:52 +04:00
parent 18899f8029
commit ef1de682a4

View File

@@ -921,7 +921,7 @@ func (p *Posix) DeleteObject(bucket, object string) error {
return fmt.Errorf("stat bucket: %w", err)
}
os.Remove(filepath.Join(bucket, object))
err = os.Remove(filepath.Join(bucket, object))
if errors.Is(err, fs.ErrNotExist) {
return s3err.GetAPIError(s3err.ErrNoSuchKey)
}