Skip to content

Commit 962fa09

Browse files
committed
Fixed attachment handling
1 parent 7404e75 commit 962fa09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/read.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ function processRead(msg, cfg) {
1717
console.log('Incoming message is %j', msg);
1818
if (!csvURL || csvURL.length == 0) {
1919
// Now let's check for the attachment
20-
if (msg && msg.attachments && msg.attachments.length > 0) {
21-
csvURL = msg.attachments[0].url
20+
if (msg && msg.attachments && Object.keys(msg.attachments).length > 0) {
21+
var key = Object.keys(msg.attachments)[0];
22+
console.log('Found attachment key=%s attachment=%j', key, msg.attachments[key]);
23+
csvURL = msg.attachments[key].url;
2224
} else {
2325
console.error('URL of the CSV is missing');
2426
that.emit('error', 'URL of the CSV is missing');

0 commit comments

Comments
 (0)