Trim leading double slashes in URL pathnames

This commit is contained in:
Jarred Sumner
2022-02-12 02:32:15 -08:00
parent 73836e19b7
commit eb93ae0d26

View File

@@ -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;
}