diff --git a/packages/server/src/store.ts b/packages/server/src/store.ts index 879241a..2d95864 100644 --- a/packages/server/src/store.ts +++ b/packages/server/src/store.ts @@ -150,7 +150,10 @@ export function ledgerStat(roomId: string): { bytes: number; mtimeMs: number } | // the room's whole truth and the room stays asleep, unreplayed. const stubDir = () => join(DATA_DIR, "..", "stubs"); -const stubFor = (roomId: string) => join(stubDir(), `${roomId}.json`); +function stubFor(roomId: string): string { + if (!safeRoomId(roomId)) throw new Error(`unsafe room id: ${JSON.stringify(roomId)}`); + return join(stubDir(), `${roomId}.json`); +} export function readStubFile(roomId: string): { bytes: number; stub: T } | null { if (!safeRoomId(roomId)) return null;