Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pushStatusHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function pushStatusHandler(config) {
expiry: body.expiration_time,
status: "pending",
numSent: 0,
pushHash: md5Hash(data.alert || ''),
pushHash: md5Hash(JSON.stringify(data.alert) || ''),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the case alert is a string, that will wrap the string into another string, including the quotes...
This should be updated to:

let pushHash;
if (typeof data.alert === 'string') {
  pushHash = md5Hash(data.alert);
} else if (typeof data.alert === 'object') {
  pushHash = md5Hash(JSON.stringify(data.alert));
} else {
   pushHash = "d41d8cd98f00b204e9800998ecf8427e"; // empty string hash
}

// lockdown!
ACL: {}
}
Expand Down