From 04c167f5aad57d20f8e27dfa06dd75647969864b Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 8 Dec 2014 21:59:21 +0100 Subject: [PATCH] fix false 'downloaded' status being returned when null hash is 'checked' --- modules/helpers.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/helpers.js b/modules/helpers.js index f97f77b..5bd4926 100644 --- a/modules/helpers.js +++ b/modules/helpers.js @@ -111,10 +111,11 @@ exp.get_image_hash = function(uuid, callback) { if (err) { callback(err, -1, details && details.hash); } else { - var oldhash = details && details.hash || "none"; - logging.debug(uuid + " old hash: " + oldhash); + // skin is only checked (3) when uuid known AND hash didn't change + // in all other cases the skin is downloaded (2) + var status = details && (details.hash == hash) ? 3 : 2; + logging.debug(uuid + " old hash: " + (details && details.hash)); logging.log(uuid + " hash: " + hash); - var status = hash == oldhash ? 3 : 2; callback(null, status, hash); } });