From 0bac62df3d66beb43f13c2a43761880b736c6745 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 14 Jun 2023 14:21:47 +0100 Subject: [PATCH] Merge pull request #13491 from overleaf/jpa-real-time-query-access [real-time] gracefully access query parameters GitOrigin-RevId: b29237a6fb20d51bbe5db7ebb429d460b1da29a6 --- services/real-time/app/js/Router.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/real-time/app/js/Router.js b/services/real-time/app/js/Router.js index 056305dc67..b48b21d6f2 100644 --- a/services/real-time/app/js/Router.js +++ b/services/real-time/app/js/Router.js @@ -119,8 +119,6 @@ module.exports = Router = { ) session.on('connection', function (error, client, session) { - const joinProjectAutomatically = !!client.handshake.query.projectId - // init client context, we may access it in Router._handleError before // setting any values client.ol_context = {} @@ -171,6 +169,7 @@ module.exports = Router = { } return } + const joinProjectAutomatically = !!client.handshake?.query?.projectId // send positive confirmation that the client has a valid connection client.publicId = 'P.' + base64id.generateId()