diff --git a/lib/pkgcloud/azure/storage/client/files.js b/lib/pkgcloud/azure/storage/client/files.js index 1b7797673..f7b34cc3d 100644 --- a/lib/pkgcloud/azure/storage/client/files.js +++ b/lib/pkgcloud/azure/storage/client/files.js @@ -329,25 +329,37 @@ exports.getFiles = function (container, options, callback) { options = {}; } + const qs = { + restype: 'container', + comp: 'list' + }; + + if (options.limit) { + qs.maxresults = options.limit; + } + if (options.marker) { + qs.marker = options.marker; + } + if (options.prefix) { + qs.prefix = options.prefix; + } + this._xmlRequest({ method: 'GET', path: containerName, - qs: { - restype: 'container', - comp: 'list' - } + qs: qs }, function (err, body) { if (err) { return callback(err); } - if (body.Blobs && body.Blobs.Blob) { - return callback(null, self._toArray(body.Blobs.Blob).map(function (file) { + + callback(null, + body.Blobs && body.Blobs.Blob && self._toArray(body.Blobs.Blob) + .map(function (file) { file.container = container; return new storage.File(self, file); - })); - } - - callback(null, []); + }) || [], + 'string' == typeof body.NextMarker && body.NextMarker + ); }); }; - diff --git a/lib/pkgcloud/azure/utils/constants.js b/lib/pkgcloud/azure/utils/constants.js index 752a205fa..33c07af08 100644 --- a/lib/pkgcloud/azure/utils/constants.js +++ b/lib/pkgcloud/azure/utils/constants.js @@ -2045,7 +2045,7 @@ var Constants = { * @const * @type {string} */ - TARGET_STORAGE_VERSION: '2011-08-18', + TARGET_STORAGE_VERSION: '2014-02-14', /** * The UserAgent header. @@ -2559,4 +2559,4 @@ var Constants = { } }; -module.exports = Constants; \ No newline at end of file +module.exports = Constants;