Merge remote-tracking branch 'ntay/sendfile-original-name' into indev

This commit is contained in:
abalabahaha
2016-01-24 16:15:28 -08:00
4 changed files with 38 additions and 6 deletions

View File

@@ -223,10 +223,15 @@ var Client = (function (_EventEmitter) {
// def sendFile
Client.prototype.sendFile = function sendFile(where, attachment) {
var name = arguments.length <= 2 || arguments[2] === undefined ? "image.png" : arguments[2];
Client.prototype.sendFile = function sendFile(where, attachment, name) {
var callback = arguments.length <= 3 || arguments[3] === undefined ? function () /*err, m*/{} : arguments[3];
if (typeof name === "function") {
// name is the callback
callback = name;
name = undefined; // Will get resolved into original filename in internal
}
return this.internal.sendFile(where, attachment, name).then(dataCallback(callback), errorCallback(callback));
};