From 7bb1910fa1162200da4dde2b635066d9431333c0 Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Tue, 26 Sep 2023 15:16:16 +0200 Subject: [PATCH] fix: sanitize userId --- .../react/react-video-demo/src/utils/useGenerateUser.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sample-apps/react/react-video-demo/src/utils/useGenerateUser.ts b/sample-apps/react/react-video-demo/src/utils/useGenerateUser.ts index a829bd9e89..590654aa79 100644 --- a/sample-apps/react/react-video-demo/src/utils/useGenerateUser.ts +++ b/sample-apps/react/react-video-demo/src/utils/useGenerateUser.ts @@ -18,13 +18,13 @@ const config: Config = { export const generateUser = (): User => { const { user_id, user_name, id } = getURLCredentials(); - const characterName: string = uniqueNamesGenerator(config); + const characterName = uniqueNamesGenerator(config); - const userName: string = user_name ?? `${characterName}`; - const userId: string = user_id ?? `demo-${userName}-${uuid()}`; + const userName = user_name ?? characterName; + const userId = user_id ?? `demo-${userName}-${uuid()}`; return { - id: userId, + id: userId.replace(/[^_\-0-9a-zA-Z@]/g, '_'), name: userName, role: id ? 'user' : 'admin', teams: ['@stream-io/video-demo'],