From b0f88519d06f323bff389a3778bb3514bad6e6fc Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sat, 21 Jan 2023 23:17:11 -0800 Subject: [PATCH] Strip fragments from URL when connecting to websocket --- web/components/stores/ClientConfigStore.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/components/stores/ClientConfigStore.tsx b/web/components/stores/ClientConfigStore.tsx index 488d4b09c..dba9e5c4d 100644 --- a/web/components/stores/ClientConfigStore.tsx +++ b/web/components/stores/ClientConfigStore.tsx @@ -321,7 +321,13 @@ export const ClientConfigStore: FC = () => { const startChat = async () => { try { const { socketHostOverride } = clientConfig; - const host = socketHostOverride || window.location.toString(); + + // Get a copy of the browser location without #fragments. + const l = window.location; + l.hash = ''; + const location = l.toString().replaceAll('#', ''); + const host = socketHostOverride || location; + ws = new WebsocketService(accessToken, '/ws', host); ws.handleMessage = handleMessage; setWebsocketService(ws);