From 7d3c41a082a07c887f50b6385279728794fadcbb Mon Sep 17 00:00:00 2001 From: tonysoft Date: Fri, 17 Oct 2014 15:04:32 -0700 Subject: [PATCH] GetFiles issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only 2 arguments passed in to GetFiles but it was expecting 3 thus “cb” was undefined… File System GetFiles should handle empty “entries” array properly… --- lib/providers/filesystem/index.js | 1 + lib/storage-service.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/providers/filesystem/index.js b/lib/providers/filesystem/index.js index 9285103..1e8b215 100644 --- a/lib/providers/filesystem/index.js +++ b/lib/providers/filesystem/index.js @@ -199,6 +199,7 @@ FileSystemProvider.prototype.getFiles = function (container, options, cb) { if (!validateName(container, cb)) return; var dir = path.join(this.root, container); fs.readdir(dir, function (err, entries) { + entries = entries ? entries : []; var files = []; var tasks = []; entries.forEach(function (f) { diff --git a/lib/storage-service.js b/lib/storage-service.js index 0f1ee66..6ef4b5e 100644 --- a/lib/storage-service.js +++ b/lib/storage-service.js @@ -154,8 +154,8 @@ StorageService.prototype.downloadStream = function (container, file, options, cb * @param {Object|String} err Error string or object * @param {Object[]} files An array of file metadata objects */ -StorageService.prototype.getFiles = function (container, options, cb) { - return this.client.getFiles(container, options, function (err, files) { +StorageService.prototype.getFiles = function (container, cb) { + return this.client.getFiles(container, false, function (err, files) { if (err) { cb(err, files); } else {