From 24413c4cc59d350fd89ef22934b0c1c6380c1f33 Mon Sep 17 00:00:00 2001 From: osher Date: Tue, 7 Aug 2018 13:43:10 +0300 Subject: [PATCH 1/5] azure - update TARGET_STORAGE_VERSION --- lib/pkgcloud/azure/utils/constants.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 4df4bb82d75a2af0aabf50f61b5fcac34b02086d Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 8 Aug 2018 10:19:58 +0300 Subject: [PATCH 2/5] azure.storage.getFiles: Support paging marker & limit --- lib/pkgcloud/azure/storage/client/files.js | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/pkgcloud/azure/storage/client/files.js b/lib/pkgcloud/azure/storage/client/files.js index 1b7797673..e552df025 100644 --- a/lib/pkgcloud/azure/storage/client/files.js +++ b/lib/pkgcloud/azure/storage/client/files.js @@ -329,25 +329,32 @@ 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 }, 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 + ); }); }; From 701da752c98bf2c52d216c89efba5cab7d44378e Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 8 Aug 2018 10:46:37 +0300 Subject: [PATCH 3/5] petty lindt :P --- lib/pkgcloud/azure/storage/client/files.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pkgcloud/azure/storage/client/files.js b/lib/pkgcloud/azure/storage/client/files.js index e552df025..ca4fab6df 100644 --- a/lib/pkgcloud/azure/storage/client/files.js +++ b/lib/pkgcloud/azure/storage/client/files.js @@ -334,9 +334,9 @@ exports.getFiles = function (container, options, callback) { comp: 'list' }; - if (options.limit) qs.maxresults = options.limit; - if (options.marker) qs.marker = options.marker; - if (options.prefix) qs.prefix = options.prefix; + 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', From f2228b323f8169cb3c90a0589369d0f910b3703a Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 8 Aug 2018 10:49:16 +0300 Subject: [PATCH 4/5] lindt again? :P --- lib/pkgcloud/azure/storage/client/files.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/pkgcloud/azure/storage/client/files.js b/lib/pkgcloud/azure/storage/client/files.js index ca4fab6df..d92a866e6 100644 --- a/lib/pkgcloud/azure/storage/client/files.js +++ b/lib/pkgcloud/azure/storage/client/files.js @@ -334,9 +334,15 @@ exports.getFiles = function (container, options, callback) { comp: 'list' }; - if (options.limit) { qs.maxresults = options.limit; } - if (options.marker) { qs.marker = options.marker; } - if (options.prefix) { qs.prefix = options.prefix; } + 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', From c4cb5b92d528fa89607aa60523a2706cd1b64f96 Mon Sep 17 00:00:00 2001 From: osher Date: Wed, 8 Aug 2018 10:51:58 +0300 Subject: [PATCH 5/5] es6/5 compat?? --- lib/pkgcloud/azure/storage/client/files.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pkgcloud/azure/storage/client/files.js b/lib/pkgcloud/azure/storage/client/files.js index d92a866e6..f7b34cc3d 100644 --- a/lib/pkgcloud/azure/storage/client/files.js +++ b/lib/pkgcloud/azure/storage/client/files.js @@ -347,7 +347,7 @@ exports.getFiles = function (container, options, callback) { this._xmlRequest({ method: 'GET', path: containerName, - qs + qs: qs }, function (err, body) { if (err) { return callback(err); @@ -363,4 +363,3 @@ exports.getFiles = function (container, options, callback) { ); }); }; -