兼容了空对象的情况,很多用户在实现 one 方法时习惯于返回一个空对象。

This commit is contained in:
刘小平 2025-07-24 16:02:48 +08:00
parent 33cf6db82c
commit e8703eae6e

View File

@ -512,7 +512,10 @@ public class StorageEngineServiceImpl implements StorageEngineService {
fileMetadataInfo.setIsFinished(Boolean.TRUE); fileMetadataInfo.setIsFinished(Boolean.TRUE);
FileMetadataInfoVo fileMetadataInfoVo = metadataRepository.one(fileMetadataInfo); FileMetadataInfoVo fileMetadataInfoVo = metadataRepository.one(fileMetadataInfo);
if (null == fileMetadataInfoVo) { if (null == fileMetadataInfoVo
|| (null == fileMetadataInfoVo.getId() && null == fileMetadataInfoVo.getFileKey() && null == fileMetadataInfoVo.getFileMd5())
) {
// 兼容了空对象的情况很多用户在实现 one 方法时习惯于返回一个空对象
// 当不存在任何该MD5值的文件元数据时删除物理文件 // 当不存在任何该MD5值的文件元数据时删除物理文件
minioS3Client.removeObject(metadata.getStorageBucket(), metadata.getStoragePath() + "/" + metadata.getFileMd5()); minioS3Client.removeObject(metadata.getStorageBucket(), metadata.getStoragePath() + "/" + metadata.getFileMd5());
if (Boolean.TRUE.equals(metadata.getIsPreview())) { if (Boolean.TRUE.equals(metadata.getIsPreview())) {