MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / sanitizeForPostgres

Function sanitizeForPostgres

packages/db/src/services/insights/engine.ts:24–28  ·  view source on GitHub ↗

* Sanitize a string for PostgreSQL by removing null bytes (0x00). * PostgreSQL text columns don't accept null bytes in UTF-8 encoding.

(str: string)

Source from the content-addressed store, hash-verified

22 * PostgreSQL text columns don't accept null bytes in UTF-8 encoding.
23 */
24function sanitizeForPostgres(str: string): string {
25 // Remove null bytes which cause "invalid byte sequence for encoding UTF8: 0x00"
26 // Using String.fromCharCode(0) to avoid linter warnings about control characters in regex
27 return str.split(String.fromCharCode(0)).join('');
28}
29
30export interface EngineConfig {
31 keepTopNPerModuleWindow: number; // e.g. 5

Callers 1

runProjectFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected