From db242b31002e3f0ef1c86dc9a8a72be08405742f Mon Sep 17 00:00:00 2001 From: Andrew Regner Date: Sat, 23 Mar 2013 13:41:43 -0500 Subject: [PATCH 1/2] fix how Container is constructed --- lib/cloudfiles/container.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cloudfiles/container.js b/lib/cloudfiles/container.js index f715481..0222f0b 100644 --- a/lib/cloudfiles/container.js +++ b/lib/cloudfiles/container.js @@ -12,6 +12,9 @@ var Container = exports.Container = function (client, details) { if (!details) { throw new Error("Container must be constructed with at least basic details.") } + if(typeof details !== 'object') { + details = {name: details}; + } this.files = []; this.client = client; From 4f5e7cf832036d80867c3fd8dc53b5d7dc1690b8 Mon Sep 17 00:00:00 2001 From: Andrew Regner Date: Sat, 23 Mar 2013 13:42:18 -0500 Subject: [PATCH 2/2] fix Container.addFile to pass arguments properly --- lib/cloudfiles/container.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/cloudfiles/container.js b/lib/cloudfiles/container.js index 0222f0b..5ba9b6f 100644 --- a/lib/cloudfiles/container.js +++ b/lib/cloudfiles/container.js @@ -23,7 +23,16 @@ var Container = exports.Container = function (client, details) { Container.prototype = { addFile: function (file, local, options, callback) { - return this.client.addFile(this.name, file, local, options, callback); + if(!options && !callback) { + options = {}; + } + if (typeof options === 'function' && !callback) { + callback = options; + options = {}; + } + options.remote = file; + options.local = local; + return this.client.addFile(this.name, options, callback); }, destroy: function (callback) {