Skip to content

Commit 6af8add

Browse files
committed
fix cookie path parsing
1 parent cf9ecbd commit 6af8add

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/browser/storage/cookie.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,11 @@ pub const Cookie = struct {
385385
return "/";
386386
}
387387

388-
return arena.dupe(u8, url_path);
388+
const last = std.mem.lastIndexOfScalar(u8, url_path[1..], '/') orelse {
389+
return "/";
390+
};
391+
392+
return arena.dupe(u8, url_path[0 .. last + 1]);
389393
}
390394

391395
pub fn parseDomain(arena: Allocator, maybe_url: ?URL, explicit_domain: ?[]const u8) ![]const u8 {

0 commit comments

Comments
 (0)