From 271aba001c09294ad4394a74f3dcc78bea82f3d9 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Thu, 4 Sep 2025 17:45:12 +0530 Subject: [PATCH] api_docs: Fix 500 error on `/api/register-remote-push-device`. `settings.ZULIP_SERVICES_URL` is used to construct curl example for `/api/register-remote-push-device`. On zulip cloud `settings.ZULIP_SERVICES_URL=None`, it resulted in 500 error on visiting that page. This commit fixes the bug by using "https://push.zulipchat.com" as the default value if `settings.ZULIP_SERVICES_URL=None`. The doc already mentions that the endpoint is meant to be used by self-hosted servers, so the default value makes sense if ZULIP_SERVICES_URL=None. --- zerver/views/documentation.py | 2 +- zproject/default_settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zerver/views/documentation.py b/zerver/views/documentation.py index 4719713525..aff82efc03 100644 --- a/zerver/views/documentation.py +++ b/zerver/views/documentation.py @@ -50,7 +50,7 @@ def add_api_url_context( context.update(zulip_default_context(request)) if is_zilencer_endpoint: - context["api_url"] = settings.ZULIP_SERVICES_URL + "/api" + context["api_url"] = (settings.ZULIP_SERVICES_URL or "https://push.zulipchat.com") + "/api" return subdomain = get_subdomain(request) diff --git a/zproject/default_settings.py b/zproject/default_settings.py index b5b1701019..5c45392d1d 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -231,7 +231,7 @@ PASSWORD_MIN_GUESSES = 10000 SESSION_EXPIRE_AT_BROWSER_CLOSE = False SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # 2 weeks -ZULIP_SERVICES_URL = "https://push.zulipchat.com" +ZULIP_SERVICES_URL: str | None = "https://push.zulipchat.com" ZULIP_SERVICE_PUSH_NOTIFICATIONS = False # For this setting, we need to have None as the default value, so