sanitizeWorkspaceAgentContextFileContent applies prompt sanitization, then enforces the 64KiB per-file budget. The truncated flag is preserved when the caller already capped the file before sending it.
( content string, truncated bool, )
| 2436 | // truncated flag is preserved when the caller already capped the |
| 2437 | // file before sending it. |
| 2438 | func sanitizeWorkspaceAgentContextFileContent( |
| 2439 | content string, |
| 2440 | truncated bool, |
| 2441 | ) (string, bool) { |
| 2442 | content = chatd.SanitizePromptText(content) |
| 2443 | if len(content) > maxChatContextFileBytes { |
| 2444 | content = content[:maxChatContextFileBytes] |
| 2445 | truncated = true |
| 2446 | } |
| 2447 | return content, truncated |
| 2448 | } |
| 2449 | |
| 2450 | // readChatContextBody reads and validates the request body for chat |
| 2451 | // context endpoints. It handles MaxBytesReader wrapping, error |
no test coverage detected