From c1aa85fc9693788a4f50e8fabe3ea4a56e192e38 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Tue, 6 Sep 2016 13:55:22 +0500 Subject: [PATCH] fix search in cached shortened URIs in newShortURI() --- js/twister_actions.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/twister_actions.js b/js/twister_actions.js index 83ec131..9bf55d1 100644 --- a/js/twister_actions.js +++ b/js/twister_actions.js @@ -326,10 +326,12 @@ function newShortURI(uri, cbFunc, cbReq) { return; } - for (var i in twister.URIs) - if (twister.URIs[i] === uri) { + for (var short in twister.URIs) + if (twister.URIs[short] instanceof Array ? + twister.URIs[short][0] === uri : twister.URIs[short] === uri) { if (typeof cbFunc === 'function') - cbFunc(uri, i, cbReq); + cbFunc(uri, short, cbReq); + return; }