Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(dev): 模拟数据路径去尾部分隔符改用循环,避免 CodeQL 多项式正则告警

Dash2d8297895ff0
diff --git a/packages/maker-shared/src/uiMock.ts b/packages/maker-shared/src/uiMock.ts
index 26e5ecbb85..5807946457 100644
--- a/packages/maker-shared/src/uiMock.ts
+++ b/packages/maker-shared/src/uiMock.ts
@@ -332,7 +332,9 @@ const MINUTE_MS = 60_000;
* demo projects; times are relative to `now` so lists always look recent.
*/
export function buildUiMockRows({ now, projectRoot }: { now: number; projectRoot: string }): UiMockRows {
- const root = projectRoot.replace(/[\\/]+$/, '');
+ let end = projectRoot.length;
+ while (end > 0 && (projectRoot[end - 1] === '/' || projectRoot[end - 1] === '\\')) end -= 1;
+ const root = projectRoot.slice(0, end);
const separator = root.includes('\\') && !root.includes('/') ? '\\' : '/';
const sessions: UiMockSessionRow[] = [];
const messages: UiMockMessageRow[] = [];