correctly identify users' limits by unescaped public key

This commit is contained in:
ansuz 2017-05-16 15:11:20 +02:00
parent 517438d7c5
commit c381e85384
1 changed files with 5 additions and 1 deletions

6
rpc.js
View File

@ -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"?