Page MenuHomePhorge

D5229.1768401497.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D5229.1768401497.diff

diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -505,6 +505,10 @@
notification.collapseId = collapseKey;
}
const messageInfos = JSON.stringify(newRawMessageInfos);
+ // We make a copy before checking notification's length, because calling
+ // length compiles the notification and makes it immutable. Further
+ // changes to its properties won't be reflected in the final plaintext
+ // data that is sent.
const copyWithMessageInfos = _cloneDeep(notification);
copyWithMessageInfos.payload = {
...copyWithMessageInfos.payload,
@@ -512,6 +516,13 @@
};
if (copyWithMessageInfos.length() <= apnMaxNotificationPayloadByteSize) {
notification.payload.messageInfos = messageInfos;
+ return notification;
+ }
+ const notificationCopy = _cloneDeep(notification);
+ if (notificationCopy.length() > apnMaxNotificationPayloadByteSize) {
+ console.warn(
+ `iOS notification ${uniqueID} exceeds size limit, even with messageInfos omitted`,
+ );
}
return notification;
}
@@ -565,6 +576,15 @@
) {
return copyWithMessageInfos;
}
+
+ if (
+ Buffer.byteLength(JSON.stringify(notification)) >
+ fcmMaxNotificationPayloadByteSize
+ ) {
+ console.warn(
+ `Android notification ${notifID} exceeds size limit, even with messageInfos omitted`,
+ );
+ }
return notification;
}

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 14, 2:38 PM (6 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5929407
Default Alt Text
D5229.1768401497.diff (1 KB)

Event Timeline