+12
-0
lines changedFilter options
+12
-0
lines changed Original file line number Diff line number Diff line change
@@ -142,6 +142,9 @@ module.exports = {
142
142
* @return {String} A native javascript string
143
143
*/
144
144
decode_utf8: function (utf8) {
145
+
if (typeof utf8 !== 'string') {
146
+
throw new Error('Parameter "utf8" is not of type string');
147
+
}
145
148
try {
146
149
return decodeURIComponent(escape(utf8));
147
150
} catch (e) {
Original file line number Diff line number Diff line change
@@ -328,4 +328,13 @@ describe('Basic', function() {
328
328
});
329
329
});
330
330
331
+
describe("Misc.", function() {
332
+
333
+
it('util.decode_utf8 throws error if invalid parameter type', function () {
334
+
var test = openpgp.util.decode_utf8.bind(null, {chameleon: true});
335
+
expect(test).to.throw(Error, /Parameter "utf8" is not of type string/);
336
+
});
337
+
338
+
});
339
+
331
340
});
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4