diff --git a/lib/tritonapi.js b/lib/tritonapi.js index a68d2d4..e5493d6 100644 --- a/lib/tritonapi.js +++ b/lib/tritonapi.js @@ -271,7 +271,11 @@ TritonApi.prototype.getImage = function getImage(name, cb) { var s = name.split('@'); name = s[0]; var version = s[1]; - this.cloudapi.listImages(function (err, imgs) { + + var opts = {}; + if (version) + opts.version = version; + this.cloudapi.listImages(opts, function (err, imgs) { if (err) { return cb(err); } @@ -280,8 +284,6 @@ TritonApi.prototype.getImage = function getImage(name, cb) { var shortIdMatches = []; for (var i = 0; i < imgs.length; i++) { var img = imgs[i]; - if (version && img.version !== version) - continue; if (img.name === name) { nameMatches.push(img); }