Call encodeURIComponent on hkp query parameters

This commit is contained in:
Tankred Hase 2015-12-19 15:23:00 +07:00
parent b60bea547b
commit 450fddaf8e

View File

@ -53,9 +53,9 @@ HKP.prototype.lookup = function(options) {
fetch = this._fetch; fetch = this._fetch;
if (options.keyId) { if (options.keyId) {
uri += '0x' + options.keyId; uri += '0x' + encodeURIComponent(options.keyId);
} else if (options.query) { } else if (options.query) {
uri += options.query; uri += encodeURIComponent(options.query);
} else { } else {
throw new Error('You must provide a query parameter!'); throw new Error('You must provide a query parameter!');
} }
@ -86,4 +86,4 @@ HKP.prototype.upload = function(publicKeyArmored) {
}, },
body: 'keytext=' + encodeURIComponent(publicKeyArmored) body: 'keytext=' + encodeURIComponent(publicKeyArmored)
}); });
}; };