Fix custom limit not applied when using a raw edPublic

pull/1/head
yflory 4 years ago committed by ansuz
parent 145386e944
commit 51e1b9b043

@ -37,13 +37,24 @@ Quota.applyCustomLimits = function (Env) {
var limits = {}; var limits = {};
Object.keys(custom).forEach(function (k) { Object.keys(custom).forEach(function (k) {
var user; var user;
try {
user = Keys.parseUser(k); // XXX this length (44) is also hardcoded in decrees.js
} catch (err) { // before calling Keys.parseUser.
return void Env.Log.error("PARSE_CUSTOM_LIMIT_BLOCK", { // Maybe we should improve Keys.parseUser to handle this
user: k, // option directly
error: err.message, if (k.length === 44) {
}); user = {
pubkey: Util.unescapeKeyCharacters(k)
}
} else {
try {
user = Keys.parseUser(k);
} catch (err) {
return void Env.Log.error("PARSE_CUSTOM_LIMIT_BLOCK", {
user: k,
error: err.message,
});
}
} }
var unsafeKey = user.pubkey; var unsafeKey = user.pubkey;

Loading…
Cancel
Save