From c381e853841055b9e7f77fda51a79f7ae0327d31 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 16 May 2017 15:11:20 +0200 Subject: [PATCH] correctly identify users' limits by unescaped public key --- rpc.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpc.js b/rpc.js index d8bbce9dd..1b92d57a8 100644 --- a/rpc.js +++ b/rpc.js @@ -78,6 +78,10 @@ var escapeKeyCharacters = function (key) { return key.replace(/\//g, '-'); }; +var unescapeKeyCharacters = function (key) { + return key.replace(/\-/g, '/'); +}; + var beginSession = function (Sessions, key) { var safeKey = escapeKeyCharacters(key); if (Sessions[safeKey]) { @@ -516,7 +520,7 @@ var updateLimits = function (config, publicKey, cb) { }; var getLimit = function (publicKey, cb) { - var unescapedKey = escapeKeyCharacters(publicKey); + var unescapedKey = unescapeKeyCharacters(publicKey); var limit = limits[unescapedKey]; var toSend = limit && typeof(limit.limit) === "number"?