Skip to content

Commit

Permalink
fix: gaoc bugsnag alert for email.trim
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Aug 29, 2024
1 parent e21ebd0 commit f0c364f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const sha256 = require('sha256');
const SqlString = require('sqlstring');
const isString = require('lodash/isString');
const { get, set, cloneDeep } = require('lodash');
const {
AbortedError,
Expand Down Expand Up @@ -271,7 +272,9 @@ const getAddConversionPayload = (message, Config) => {

const userIdentifierInfo = {
email:
hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email.trim()).toString() : email,
hashUserIdentifier && isString(email) && isDefinedAndNotNull(email)
? sha256(email.trim()).toString()
: email,
phone:
hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone.trim()).toString() : phone,
address: buildAndGetAddress(message, hashUserIdentifier),
Expand Down Expand Up @@ -367,7 +370,9 @@ const getClickConversionPayloadAndEndpoint = (

const userIdentifierInfo = {
email:
hashUserIdentifier && isDefinedAndNotNull(email) ? sha256(email.trim()).toString() : email,
hashUserIdentifier && isString(email) && isDefinedAndNotNull(email)
? sha256(email.trim()).toString()
: email,
phone:
hashUserIdentifier && isDefinedAndNotNull(phone) ? sha256(phone.trim()).toString() : phone,
};
Expand Down

0 comments on commit f0c364f

Please sign in to comment.