You've already forked DataMate
fix: 修复 codex 审查发现的两个问题
- [P1] 当 logicalPath 为 null 时,直接删除当前文件(兼容旧数据) - [P2] 数据库删除失败时,return 跳过后续清理以避免数据不一致
This commit is contained in:
@@ -587,6 +587,12 @@ public class DatasetFileApplicationService {
|
||||
}
|
||||
String logicalPath = file.getLogicalPath();
|
||||
|
||||
// 如果 logicalPath 为 null,直接删除当前文件(兼容旧数据)
|
||||
if (logicalPath == null) {
|
||||
deleteDatasetFileInternal(datasetId, file);
|
||||
return;
|
||||
}
|
||||
|
||||
List<DatasetFile> allVersions = datasetFileRepository.findAllByDatasetIdAndLogicalPath(datasetId, logicalPath);
|
||||
|
||||
for (DatasetFile versionFile : allVersions) {
|
||||
@@ -608,6 +614,8 @@ public class DatasetFileApplicationService {
|
||||
datasetFileRepository.removeById(file.getId());
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to delete file record from database: fileId={}", file.getId(), e);
|
||||
// 数据库删除失败时,跳过后续清理以避免数据不一致
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isArchivedStatus(file)) {
|
||||
|
||||
Reference in New Issue
Block a user