Skip to content

Commit 048a6da

Browse files
committed
fix cookie path parsing
1 parent b307473 commit 048a6da

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
@@ -344,7 +344,11 @@ pub const Cookie = struct {
344344
return "/";
345345
}
346346

347-
return arena.dupe(u8, url_path);
347+
const last = std.mem.lastIndexOfScalar(u8, url_path[1..], '/') orelse {
348+
return "/";
349+
};
350+
351+
return arena.dupe(u8, url_path[0 .. last + 1]);
348352
}
349353

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

0 commit comments

Comments
 (0)