mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
Trim leading double slashes in URL pathnames
This commit is contained in:
@@ -294,6 +294,10 @@ pub const URL = struct {
|
||||
url.pathname = "/";
|
||||
}
|
||||
|
||||
while (url.pathname.len > 1 and @bitCast(u16, url.pathname[0..2].*) == comptime std.mem.readIntNative(u16, "//")) {
|
||||
url.pathname = url.pathname[1..];
|
||||
}
|
||||
|
||||
url.origin = std.mem.trim(u8, url.origin, "/ ?#");
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user