Skip to content

Commit

Permalink
Fix issue when parsing invalid cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmcq committed Apr 18, 2018
1 parent 072b490 commit fb522e8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions cookiejar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@
if (this instanceof Cookie) {
var parts = str.split(";").filter(function (value) {
return !!value;
}),
pair = parts[0].match(/([^=]+)=([\s\S]*)/),
key = pair[1],
value = pair[2],
i;
});
var i;

var pair = parts[0].match(/([^=]+)=([\s\S]*)/);
if (!pair) return;

var key = pair[1];
var value = pair[2];
if (!key || !value) return;

this.name = key;
this.value = value;

Expand Down

0 comments on commit fb522e8

Please sign in to comment.