diff options
author | 2022-02-12 02:32:15 -0800 | |
---|---|---|
committer | 2022-02-12 02:32:15 -0800 | |
commit | eb93ae0d2685c4526d6bea4e11ec817c80e7f2aa (patch) | |
tree | 9df4d9a0554a96dd3107a8953dbbeb869860151d | |
parent | 73836e19b746d7927a9234e6114050633a68899a (diff) | |
download | bun-eb93ae0d2685c4526d6bea4e11ec817c80e7f2aa.tar.gz bun-eb93ae0d2685c4526d6bea4e11ec817c80e7f2aa.tar.zst bun-eb93ae0d2685c4526d6bea4e11ec817c80e7f2aa.zip |
Trim leading double slashes in URL pathnames
-rw-r--r-- | src/query_string_map.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/query_string_map.zig b/src/query_string_map.zig index 9fcea07a1..292e581b0 100644 --- a/src/query_string_map.zig +++ b/src/query_string_map.zig @@ -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; } |