mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
AK: Support serializing opaque hosts
The spec indicates we should support serializing opaque hosts, but we were assuming the host contained a String. Opaque hosts are represented with Empty. Return an empty string here instead to prevent crashing on an invalid variant access.
This commit is contained in:
parent
dcfec8bfbe
commit
66e1f8cdab
1 changed files with 3 additions and 1 deletions
|
@ -632,7 +632,9 @@ ErrorOr<String> URLParser::serialize_host(URL::Host const& host)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Otherwise, host is a domain, opaque host, or empty host, return host.
|
// 3. Otherwise, host is a domain, opaque host, or empty host, return host.
|
||||||
return host.get<String>();
|
if (host.has<String>())
|
||||||
|
return host.get<String>();
|
||||||
|
return String {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
|
// https://url.spec.whatwg.org/#start-with-a-windows-drive-letter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue