Skip to content

Commit 2230723

Browse files
committed
url: accept about:blank
1 parent b87a80a commit 2230723

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/url.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ pub const URL = struct {
1313
// In most cases though, we assume the caller will just dupe the string URL
1414
// into an arena
1515
pub fn parse(str: []const u8, default_scheme: ?[]const u8) !URL {
16-
const uri = Uri.parse(str) catch try Uri.parseAfterScheme(default_scheme orelse "https", str);
16+
var uri = Uri.parse(str) catch try Uri.parseAfterScheme(default_scheme orelse "https", str);
17+
18+
// special case, url scheme is about, like about:blank.
19+
// Use an empty string as host.
20+
if (std.mem.eql(u8, uri.scheme, "about")) {
21+
uri.host = .{ .percent_encoded = "" };
22+
}
23+
1724
if (uri.host == null) {
1825
return error.MissingHost;
1926
}

0 commit comments

Comments
 (0)