From 2825500e2693dbac3257d23b077bc33f9e11f23a Mon Sep 17 00:00:00 2001 From: Lendemor Date: Thu, 9 Jan 2025 11:22:40 +0100 Subject: [PATCH] review changes --- reflex/app.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/reflex/app.py b/reflex/app.py index d0c9592c4..d5d74e362 100644 --- a/reflex/app.py +++ b/reflex/app.py @@ -15,6 +15,7 @@ import multiprocessing import platform import sys import traceback +import urllib.parse import uuid from datetime import datetime from pathlib import Path @@ -1536,10 +1537,7 @@ class EventNamespace(AsyncNamespace): sid: The Socket.IO session id. environ: The request information, including HTTP headers. """ - query_string = environ.get("QUERY_STRING") - query_params = dict( - qc.split("=") for qc in query_string.split("&") if "=" in qc - ) + query_params = urllib.parse.parse_qs(environ.get("QUERY_STRING")) await self.link_token_to_sid(sid, query_params.get("token")) def on_disconnect(self, sid): @@ -1621,7 +1619,7 @@ class EventNamespace(AsyncNamespace): token: The client token. """ if token in self.sid_to_token.values() and sid != self.token_to_sid.get(token): - token = uuid.uuid4().hex + token = str(uuid.uuid4()) await self.emit("new_token", token, to=sid) self.token_to_sid[token] = sid