Skip to content

Commit

Permalink
Merge pull request #307 from ryanseys/fix-pubsub
Browse files Browse the repository at this point in the history
fix: pubsub ack regression test - empty message
  • Loading branch information
stephenplusplus committed Nov 24, 2014
2 parents 0ef2c4a + 57213ee commit 7b4e843
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/pubsub/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ Subscription.formatMessage_ = function(msg) {
var message = {
id: msg.ackId
};
if (msg.pubsubEvent && msg.pubsubEvent.message) {
message.data =
new Buffer(msg.pubsubEvent.message.data, 'base64').toString('utf-8');
var evt = msg.pubsubEvent;
if (evt && evt.message && evt.message.data) {
message.data = new Buffer(evt.message.data, 'base64').toString('utf-8');
try {
message.data = JSON.parse(message.data);
} catch(e) {}
Expand Down

0 comments on commit 7b4e843

Please sign in to comment.