Skip to content

Commit e08fef5

Browse files
dcramerclaude
andcommitted
fix(nitro): Address review bot feedback
Replace local esc() with shared escapeXml from @/chat/xml and escape all regex-special characters in glob-to-regex conversion, not just dots. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9016316 commit e08fef5

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

packages/junior/src/handlers/diagnostics-dashboard.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1+
import { escapeXml as esc } from "@/chat/xml";
12
import { GET as diagnosticsGET } from "@/handlers/diagnostics";
23
import { GET as healthGET } from "@/handlers/health";
34

4-
function esc(s: string): string {
5-
return s
6-
.replace(/&/g, "&amp;")
7-
.replace(/</g, "&lt;")
8-
.replace(/>/g, "&gt;")
9-
.replace(/"/g, "&quot;");
10-
}
11-
125
/** Serve an HTML diagnostics dashboard showing health, plugins, and skills. */
136
export async function GET(): Promise<Response> {
147
let health: { ok: boolean; data?: Record<string, unknown>; error?: string };

packages/junior/src/nitro.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ function copyIncludedFiles(serverRoot: string, patterns?: string[]): void {
135135

136136
const entries = readdirSync(sourceDir);
137137
const re = fileGlob.includes("*")
138-
? new RegExp(`^${fileGlob.replace(/\./g, "\\.").replace(/\*/g, ".*")}$`)
138+
? new RegExp(
139+
`^${fileGlob.replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*")}$`,
140+
)
139141
: null;
140142

141143
for (const entry of entries) {

0 commit comments

Comments
 (0)