fix(push_notification): use cstr to convert a None body to empty string (#32056)
This commit is contained in:
parent
0da49edc8f
commit
6d9d4f9e86
1 changed files with 3 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue