From 3468e82b043c3da238cca48904295cb286f09568 Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Mon, 27 Jan 2025 09:23:48 -0500 Subject: [PATCH] feat: Sanitize FRONTEND_URL by removing quotes for improved URL parsing --- backend/server/main/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/server/main/settings.py b/backend/server/main/settings.py index 063bf35..c83c711 100644 --- a/backend/server/main/settings.py +++ b/backend/server/main/settings.py @@ -127,13 +127,16 @@ USE_L10N = True USE_TZ = True -FRONTEND_URL = getenv('FRONTEND_URL', 'http://localhost:3000') +unParsedFrontenedUrl = getenv('FRONTEND_URL', 'http://localhost:3000') +FRONTEND_URL = unParsedFrontenedUrl.replace("'", "").replace('"', '') SESSION_COOKIE_SAMESITE = None SESSION_COOKIE_SECURE = FRONTEND_URL.startswith('https') # Parse the FRONTEND_URL +# Remove and ' from the URL + parsed_url = urlparse(FRONTEND_URL) hostname = parsed_url.hostname