correctly identify users' limits by unescaped public key

pull/1/head
ansuz 8 years ago
parent 517438d7c5
commit c381e85384

@ -78,6 +78,10 @@ var escapeKeyCharacters = function (key) {
return key.replace(/\//g, '-'); return key.replace(/\//g, '-');
}; };
var unescapeKeyCharacters = function (key) {
return key.replace(/\-/g, '/');
};
var beginSession = function (Sessions, key) { var beginSession = function (Sessions, key) {
var safeKey = escapeKeyCharacters(key); var safeKey = escapeKeyCharacters(key);
if (Sessions[safeKey]) { if (Sessions[safeKey]) {
@ -516,7 +520,7 @@ var updateLimits = function (config, publicKey, cb) {
}; };
var getLimit = function (publicKey, cb) { var getLimit = function (publicKey, cb) {
var unescapedKey = escapeKeyCharacters(publicKey); var unescapedKey = unescapeKeyCharacters(publicKey);
var limit = limits[unescapedKey]; var limit = limits[unescapedKey];
var toSend = limit && typeof(limit.limit) === "number"? var toSend = limit && typeof(limit.limit) === "number"?

Loading…
Cancel
Save