Skip to content

Commit de2c5a4

Browse files
committed
Use slice for last letter
1 parent 5dc9237 commit de2c5a4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Lib/http/cookiejar.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,11 @@ def domain_return_ok(self, domain, request):
11901190
def path_return_ok(self, path, request):
11911191
_debug("- checking cookie path=%s", path)
11921192
req_path = request_path(request)
1193+
pathlen = len(path)
11931194
if req_path == path:
11941195
return True
11951196
elif (req_path.startswith(path) and
1196-
(path.endswith("/") or req_path[len(path)] == "/")):
1197+
(path.endswith("/") or req_path[pathlen:pathlen+1] == "/")):
11971198
return True
11981199

11991200
_debug(" %s does not path-match %s", req_path, path)

0 commit comments

Comments
 (0)