1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 15:23:33 +00:00

Parse web push payload JSON (#13594)

This commit is contained in:
Matt Gibson
2025-02-28 09:53:43 -08:00
committed by GitHub
parent 7da329da45
commit 40f7a0d73f
2 changed files with 13 additions and 2 deletions

View File

@@ -12,7 +12,16 @@ export class NotificationResponse extends BaseResponse {
this.contextId = this.getResponseProperty("ContextId");
this.type = this.getResponseProperty("Type");
const payload = this.getResponseProperty("Payload");
let payload = this.getResponseProperty("Payload");
if (typeof payload === "string") {
try {
payload = JSON.parse(payload);
} catch {
// guess it was a string
}
}
switch (this.type) {
case NotificationType.SyncCipherCreate:
case NotificationType.SyncCipherDelete: