Skip to content

Commit 29d131b

Browse files
committed
fixing spaces issue in snapshot name
1 parent 8ce91ab commit 29d131b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMes
7676
throw new Error(`Invalid snapshot options; rejectionThreshold (${snapshot.options.rejectionThreshold}) must be greater than approvalThreshold (${snapshot.options.approvalThreshold})`);
7777
}
7878
}
79+
snapshot.name=snapshot?.name?.trim().replace(/\s+/g,'_');
7980

8081
// Fetch sessionId from snapshot options if present
8182
const sessionId = snapshot?.options?.sessionId;
@@ -242,7 +243,7 @@ export default async (ctx: Context): Promise<FastifyInstance<Server, IncomingMes
242243
try {
243244
ctx.log.debug(`request.query : ${JSON.stringify(request.query)}`);
244245
const { contextId, pollTimeout, snapshotName: rawSnapshotName } = request.query as { contextId: string, pollTimeout: number, snapshotName: string };
245-
const snapshotName = rawSnapshotName?.trim();
246+
const snapshotName = rawSnapshotName?.trim().replace(/\s+/g,'_');
246247
if (!contextId || !snapshotName) {
247248
throw new Error('contextId and snapshotName are required parameters');
248249
}

0 commit comments

Comments
 (0)