Sanitizes a session ID and joins it with the checkpoint directory to produce a safe per-session path, preventing traversal.
private getSessionDir(sessionId: string): string {
const safeId = sessionId.replace(/[^a-zA-Z0-9_-]/g, "_");
return path.join(this.config.checkpointDir, safeId);
}
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key