fix(push_notification): use cstr to convert a None body to empty string (#32056)

This commit is contained in:
Tarun Pratap Singh 2025-04-10 12:47:30 +05:30 committed by GitHub
parent 0da49edc8f
commit 6d9d4f9e86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,6 +3,7 @@ from urllib.parse import urlparse
import frappe
from frappe import sbool
from frappe.utils.data import cstr
from frappe.utils.response import Response
from .frappeclient import FrappeClient
@ -117,6 +118,7 @@ class PushNotification:
data["click_action"] = link
if icon:
data["notification_icon"] = icon
body = cstr(body)
if len(body) > 1000:
if truncate_body:
body = body[:1000]
@ -161,6 +163,7 @@ class PushNotification:
data["click_action"] = link
if icon:
data["notification_icon"] = icon
body = cstr(body)
if len(body) > 1000:
if truncate_body:
body = body[:1000]