this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

sanitize string

alice f8dd1919 ec36b29e

+11 -6
+1
.env.example
··· 2 2 RELAY_URL=https://bsky.network 3 3 PLC_DB_PATH=/path/to/plc/mirror.db 4 4 METRICS_PORT=9501 5 + DATABASE_URL=postgresql://user:password@localhost:5432/bsky
+4
src/helpers.ts
··· 97 97 // For other types (number, boolean, etc.), return as-is 98 98 return input; 99 99 } 100 + 101 + export function sanitizeString(input: string): string { 102 + return input.replace(/\0/g, ''); 103 + }
+6 -6
src/stages/stage3.ts
··· 5 5 import { PDS_DATA_FETCH_CONCURRENCY, PYTHON_SERVICE_TIMEOUT_MS } from '../constants.js'; 6 6 import { postBatchQueue, profileBatchQueue } from '../db/postgresBatchQueues.js'; 7 7 import { batchNormalizeEmojis } from '../emojiNormalization.js'; 8 - import { sanitizeTimestamp } from '../helpers.js'; 8 + import { sanitizeString, sanitizeTimestamp } from '../helpers.js'; 9 9 import { redis } from '../redis.js'; 10 10 import { 11 11 BskyData, ··· 89 89 const data: PostData = { 90 90 cid: postData.cid, 91 91 did: did, 92 - rkey: rkey, 92 + rkey: sanitizeString(rkey), 93 93 hasEmojis: hasEmojis, 94 94 langs: Array.from(langs), 95 95 emojis: normalizedEmojis, 96 - post: postData.text, 96 + post: sanitizeString(postData.text), 97 97 createdAt: sanitizedCreatedAt, 98 98 }; 99 99 postBatchQueue.enqueue(data).catch((err: unknown) => { ··· 128 128 const data: ProfileData = { 129 129 cid: profileData.cid, 130 130 did: did, 131 - rkey: rkey, 132 - displayName: profileData.displayName ?? '', 133 - description: profileData.description ?? '', 131 + rkey: sanitizeString(rkey), 132 + displayName: sanitizeString(profileData.displayName ?? ''), 133 + description: sanitizeString(profileData.description ?? ''), 134 134 createdAt: sanitizedCreatedAt, 135 135 hasDisplayNameEmojis: hasDisplayNameEmojis, 136 136 hasDescriptionEmojis: hasDescriptionEmojis,