Skip to content

Change pushHash with stringified data#2397

Merged
flovilmart merged 4 commits intoparse-community:masterfrom
alenoir:master
Aug 9, 2016
Merged

Change pushHash with stringified data#2397
flovilmart merged 4 commits intoparse-community:masterfrom
alenoir:master

Conversation

@alenoir
Copy link
Copy Markdown
Contributor

@alenoir alenoir commented Jul 26, 2016

Notification with loc-key and loc-args crash because data.alert is not a string.

e.g.

alert: {
  'loc-key': '....',
  'loc-args': '...',
}

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 26, 2016

Current coverage is 92.47% (diff: 100%)

Merging #2397 into master will increase coverage by 0.63%

@@             master      #2397   diff @@
==========================================
  Files            95         93     -2   
  Lines         10708      10622    -86   
  Methods        1309       1311     +2   
  Messages          0          0          
  Branches       1741       1727    -14   
==========================================
- Hits           9835       9823    -12   
+ Misses          873        799    -74   
  Partials          0          0          

Powered by Codecov. Last update 831b29b...7ca6190

@ghost
Copy link
Copy Markdown

ghost commented Jul 26, 2016

@alenoir updated the pull request.

1 similar comment
@ghost
Copy link
Copy Markdown

ghost commented Jul 26, 2016

@alenoir updated the pull request.

@ghost
Copy link
Copy Markdown

ghost commented Jul 26, 2016

@alenoir updated the pull request.

@ghost
Copy link
Copy Markdown

ghost commented Jul 27, 2016

@alenoir updated the pull request.

@alenoir
Copy link
Copy Markdown
Contributor Author

alenoir commented Jul 27, 2016

as we said in 676d2e2 i replace payloadstring by stringify data.alert for localization format

@protspace
Copy link
Copy Markdown

the same for me.
info: warning: error while sending push TypeError: Not a string or buffer
and then

Error: {"code":141,"message":{"code":107,"message":"Received an error with invalid JSON from Parse: <html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.6.2</center>\r\n</body>\r\n</html>\r\n"}}

@0xthk
Copy link
Copy Markdown

0xthk commented Aug 6, 2016

This should be merged soon... All iOS localized push will fail on version 2.2.17!

Comment thread src/pushStatusHandler.js Outdated
status: "pending",
numSent: 0,
pushHash: md5Hash(data.alert || ''),
pushHash: md5Hash(JSON.stringify(data.alert) || ''),
Copy link
Copy Markdown
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
}

@flovilmart
Copy link
Copy Markdown
Contributor

thanks @alenoir. Tests would have been nice too.

@facebook-github-bot
Copy link
Copy Markdown

@alenoir updated the pull request.

1 similar comment
@ghost
Copy link
Copy Markdown

ghost commented Aug 9, 2016

@alenoir updated the pull request.

@flovilmart
Copy link
Copy Markdown
Contributor

Thanks @alenoir, merging after travis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants