From 26c8cba322d10a6175f3aa733230ec95db0de8ac Mon Sep 17 00:00:00 2001 From: Aaron Heckmann Date: Mon, 12 May 2025 00:46:30 -0700 Subject: [PATCH] [WEB-4008] fix: handle when settings are None #7016 https://app.plane.so/plane/browse/WEB-4008/ --- apiserver/plane/authentication/utils/host.py | 8 ++++++-- apiserver/plane/utils/host.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apiserver/plane/authentication/utils/host.py b/apiserver/plane/authentication/utils/host.py index 67c8a4f723..415791a879 100644 --- a/apiserver/plane/authentication/utils/host.py +++ b/apiserver/plane/authentication/utils/host.py @@ -21,7 +21,9 @@ def base_host( # Admin redirection if is_admin: - admin_base_path = getattr(settings, "ADMIN_BASE_PATH", "/god-mode/") + admin_base_path = getattr(settings, "ADMIN_BASE_PATH", None) + if not isinstance(admin_base_path, str): + admin_base_path = "/god-mode/" if not admin_base_path.startswith("/"): admin_base_path = "/" + admin_base_path if not admin_base_path.endswith("/"): @@ -34,7 +36,9 @@ def base_host( # Space redirection if is_space: - space_base_path = getattr(settings, "SPACE_BASE_PATH", "/spaces/") + space_base_path = getattr(settings, "SPACE_BASE_PATH", None) + if not isinstance(space_base_path, str): + space_base_path = "/spaces/" if not space_base_path.startswith("/"): space_base_path = "/" + space_base_path if not space_base_path.endswith("/"): diff --git a/apiserver/plane/utils/host.py b/apiserver/plane/utils/host.py index d74a86ffdf..860e19e0e3 100644 --- a/apiserver/plane/utils/host.py +++ b/apiserver/plane/utils/host.py @@ -25,7 +25,9 @@ def base_host( # Admin redirection if is_admin: - admin_base_path = getattr(settings, "ADMIN_BASE_PATH", "/god-mode/") + admin_base_path = getattr(settings, "ADMIN_BASE_PATH", None) + if not isinstance(admin_base_path, str): + admin_base_path = "/god-mode/" if not admin_base_path.startswith("/"): admin_base_path = "/" + admin_base_path if not admin_base_path.endswith("/"): @@ -38,7 +40,9 @@ def base_host( # Space redirection if is_space: - space_base_path = getattr(settings, "SPACE_BASE_PATH", "/spaces/") + space_base_path = getattr(settings, "SPACE_BASE_PATH", None) + if not isinstance(space_base_path, str): + space_base_path = "/spaces/" if not space_base_path.startswith("/"): space_base_path = "/" + space_base_path if not space_base_path.endswith("/"):