Skip to content

Commit 04f38d3

Browse files
committed
test(agents): avoid string spread in ASCII predicate
Replace the spread-based helper with an index loop to satisfy the lint rule against spreading strings (which can split multi-byte characters). Test behavior is unchanged.
1 parent c373dae commit 04f38d3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/auto-reply/reply/agent-turn-attachments.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ import { resolveInlineAgentImageAttachments } from "./agent-turn-attachments.js"
55
const VALID_PNG_BASE64 =
66
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
77

8-
const isAsciiOnly = (value: string): boolean =>
9-
[...value].every((ch) => ch.charCodeAt(0) <= 0x7f);
8+
const isAsciiOnly = (value: string): boolean => {
9+
for (let i = 0; i < value.length; i += 1) {
10+
if (value.charCodeAt(i) > 0x7f) {
11+
return false;
12+
}
13+
}
14+
return true;
15+
};
1016

1117
describe("resolveInlineAgentImageAttachments base64 safety", () => {
1218
it("re-encodes raw latin1/binary data into ASCII base64", () => {

0 commit comments

Comments
 (0)