Skip to content

Commit b462ac9

Browse files
committed
Refine path normalization and action handling in audit logs
- Updated the normalizePath function to remove trailing slashes in API paths. - Adjusted actionMap to eliminate the trailing slash for the binding creation/update action for consistency.
1 parent e3f7962 commit b462ac9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pages/audit-logs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export const getUA = (userAgent: string) => {
3737

3838
const { Text } = Typography;
3939

40-
// 将 path 中的数字替换为 {id}
40+
// 将 path 中的数字替换为 {id},并移除末尾的斜杠
4141
const normalizePath = (path: string): string => {
42-
return path.replace(/\/\d+/g, '/{id}');
42+
return path.replace(/\/\d+/g, '/{id}').replace(/\/$/, '');
4343
};
4444

4545
// API 操作语义映射字典(只包含写操作)
@@ -67,7 +67,7 @@ const actionMap: Record<string, string> = {
6767
'PUT /app/{id}/version/{id}': '修改热更包设置',
6868
'DELETE /app/{id}/version/{id}': '删除热更包',
6969
// 绑定相关
70-
'POST /app/{id}/binding/': '创建/更新绑定',
70+
'POST /app/{id}/binding': '创建/更新绑定',
7171
'DELETE /app/{id}/binding/{id}': '删除绑定',
7272
};
7373

0 commit comments

Comments
 (0)