fix: 修复代码审查发现的所有 bug
Critical 级别: - zhipu.ts: 添加 API 响应边界检查 - DictionaryClient.tsx: 添加 entries 数组边界检查 - subtitleParser.ts: 修复 getNearestIndex 逻辑错误 High 级别: - text-speaker/page.tsx: 修复非空断言和 ref 检查 - folder-repository.ts: 添加 user 关系 null 检查 Medium 级别: - InFolder.tsx: 修复 throw result.message 为 throw new Error() - localStorageOperators.ts: 返回类型改为 T | null,添加 schema 验证 - SaveList.tsx: 处理 data 可能为 null 的情况
This commit is contained in:
@@ -192,8 +192,8 @@ export async function repoGetPublicFolders(
|
||||
visibility: folder.visibility,
|
||||
createdAt: folder.createdAt,
|
||||
userId: folder.userId,
|
||||
userName: folder.user.name,
|
||||
userUsername: folder.user.username,
|
||||
userName: folder.user?.name ?? "Unknown",
|
||||
userUsername: folder.user?.username ?? "unknown",
|
||||
totalPairs: folder._count.pairs,
|
||||
favoriteCount: folder._count.favorites,
|
||||
}));
|
||||
@@ -221,8 +221,8 @@ export async function repoSearchPublicFolders(
|
||||
visibility: folder.visibility,
|
||||
createdAt: folder.createdAt,
|
||||
userId: folder.userId,
|
||||
userName: folder.user.name,
|
||||
userUsername: folder.user.username,
|
||||
userName: folder.user?.name ?? "Unknown",
|
||||
userUsername: folder.user?.username ?? "unknown",
|
||||
totalPairs: folder._count.pairs,
|
||||
favoriteCount: folder._count.favorites,
|
||||
}));
|
||||
@@ -300,8 +300,8 @@ export async function repoGetUserFavorites(input: RepoInputGetUserFavorites) {
|
||||
folderCreatedAt: fav.folder.createdAt,
|
||||
folderTotalPairs: fav.folder._count.pairs,
|
||||
folderOwnerId: fav.folder.userId,
|
||||
folderOwnerName: fav.folder.user.name,
|
||||
folderOwnerUsername: fav.folder.user.username,
|
||||
folderOwnerName: fav.folder.user?.name ?? "Unknown",
|
||||
folderOwnerUsername: fav.folder.user?.username ?? "unknown",
|
||||
favoritedAt: fav.createdAt,
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user