mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +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
Notes:
sideshowbarker
2024-07-16 22:51:10 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/66e1f8cdab Pull-request: https://github.com/SerenityOS/serenity/pull/20438 Reviewed-by: https://github.com/AtkinsSJ
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.
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue