Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33030779
D5229.1768401497.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D5229.1768401497.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5229: [native] Warn if notif is too big after omiting messageInfo
Attached
Detach File
Event Timeline
Log In to Comment