Skip to content

Commit b94f312

Browse files
committed
Merge pull request #19 from andyburke/fix_explicit_path
Fix an issue with explicit_path
2 parents 012ba93 + 0be1456 commit b94f312

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

cookiejar.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@
133133
if (this.path && access_info.path.indexOf(this.path) !== 0) {
134134
return false;
135135
}
136-
if (!this.explicit_path) {
137-
if (this.path !== access_info.path) {
138-
return false;
139-
}
136+
if (this.explicit_path && this.path !== access_info.path) {
137+
return false;
140138
}
141139
var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/,'');
142140
var cookie_domain = this.domain && this.domain.replace(/^[\.]/,'');
@@ -209,6 +207,7 @@
209207
}
210208
continue;
211209
}
210+
212211
if (cookie.matches(access_info)) {
213212
return cookie;
214213
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cookiejar",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"author": {
55
"name": "bradleymeck"
66
},

tests/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/"));
7070
assert.equal(cookie.name, "sub");
7171
assert.equal(cookie.domain, "test.com");
7272

73-
test_jar.setCookie(new Cookie("sub=4;", "test.com", "/accounts"));
74-
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/"));
73+
test_jar.setCookie(new Cookie("sub=4;path=/accounts", "test.com", "/accounts"));
74+
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/foo"));
7575
assert.equal(cookie, undefined);
7676

7777
var cookie = test_jar.getCookie("sub", CookieAccessInfo("test.com", "/accounts"));

0 commit comments

Comments
 (0)