kevinohara80 / nforce

nforce is a node.js salesforce REST API wrapper for force.com, database.com, and salesforce.com
MIT License
474 stars 167 forks source link

Issue in Record.prototype.getFileName #56

Closed avivien closed 10 years ago

avivien commented 10 years ago

Location: lib/record.js

The Record.prototype.setAttachment function and Record.prototype.getFileName are inconsistent due to case sensitivity.

Record.prototype.setAttachment = function(fileName, body) { this._attachment = { filename: fileName, body: body }; } Record.prototype.getFileName = function() { return (this._attachment) ? this._attachment.fileName : undefined; }

setAttachment use a lowercase key for filename, but getFileName try to get the value in fileName key, so the getFileName function always returns undefined.

avivien commented 10 years ago

A workaround is to directly set a value to _attachment instead of using setAttachment function: sObject._attachment = { filename: filename, fileName: filename, body: body };

kevinohara80 commented 10 years ago

This is a bug. I'll patch it by making the keys consistent.

kevinohara80 commented 10 years ago

Closed and released. Thanks.