ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(notifications): reject null updates
Marcos Paulo Diniz7a091d440d14
diff --git a/backend/app/api/notifications.py b/backend/app/api/notifications.pyindex ac9c4b3f..f574c91f 100644--- a/backend/app/api/notifications.py+++ b/backend/app/api/notifications.py@@ -429,8 +429,8 @@ def add_chat_connection():def update_chat_connection(conn_id):"""Update mutable chat connection metadata and credentials."""from app.services.chat_webhook_service import ChatWebhookService- data = request.get_json()- if data is None:+ data = request.get_json(silent=True)+ if data is None and not request.is_json:data = {}try:conn = ChatWebhookService.update(conn_id, data)diff --git a/backend/tests/test_notification_chat_connections.py b/backend/tests/test_notification_chat_connections.pyindex 1b57dca4..13140686 100644--- a/backend/tests/test_notification_chat_connections.py+++ b/backend/tests/test_notification_chat_connections.py@@ -451,7 +451,7 @@ class TestApi:assert resp.status_code == 400assert 'kind cannot be changed' in resp.get_json()['error']- @pytest.mark.parametrize('payload', [[], False])+ @pytest.mark.parametrize('payload', [[], False, None])def test_update_connection_rejects_falsy_non_object_json(self, app, client,auth_headers, payload):conn = ChatWebhookService.add({@@ -460,7 +460,8 @@ class TestApi:resp = client.put(f'/api/v1/notifications/admin/chat-connections/{conn.id}',- json=payload,+ data=json.dumps(payload),+ content_type='application/json',headers=auth_headers,)