Skip to content

Commit 418c234

Browse files
committed
test(gateway): prove config path UTF-16 boundary
1 parent c788502 commit 418c234

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/gateway/server-methods/config.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,19 @@ describe("config.openFile", () => {
132132
});
133133
});
134134

135+
it("does not split surrogate pairs when truncating the failed config path", async () => {
136+
const pathPrefix = `/tmp/${"a".repeat(111)}`;
137+
await withEnvAsync({ OPENCLAW_CONFIG_PATH: `${pathPrefix}😀tail.json` }, async () => {
138+
mockExecFileError(new Error("open failed"));
139+
140+
const { logGateway } = await invokeConfigOpenFile();
141+
142+
expect(logGateway.warn).toHaveBeenCalledWith(
143+
`config.openFile failed path=${pathPrefix}...: open failed`,
144+
);
145+
});
146+
});
147+
135148
it("returns actionable headless environment error when xdg-open reports no method available", async () => {
136149
await withEnvAsync({ OPENCLAW_CONFIG_PATH: "/tmp/config.json" }, async () => {
137150
mockExecFileError(new Error("xdg-open: no method available for opening '/tmp/config.json'"));

0 commit comments

Comments
 (0)