1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibURL/Pattern: Do not trim whitespace interpreting port

It turns out that the problem here was simply that we were trimming
trailing whitespace when we did not need to, which was meaning that
the port number of '80 ' was being converted to the empty string
per URLPattern elision as the port matches the http scheme.
This commit is contained in:
Shannon Booth 2025-04-07 11:24:01 +12:00 committed by Tim Flynn
parent 25e343464d
commit 565ccc04a9
Notes: github-actions[bot] 2025-04-07 14:30:25 +00:00
2 changed files with 4 additions and 4 deletions

View file

@ -95,7 +95,7 @@ PatternErrorOr<Pattern> Pattern::create(Input const& input, Optional<String> con
// 6. If processedInit["protocol"] is a special scheme and processedInit["port"] is a string which represents its
// corresponding default port in radix-10 using ASCII digits then set processedInit["port"] to the empty string.
if (is_special_scheme(processed_init.protocol.value())) {
auto maybe_port = processed_init.port->to_number<u16>();
auto maybe_port = processed_init.port->to_number<u16>(TrimWhitespace::No);
if (maybe_port.has_value() && *maybe_port == default_port_for_scheme(*processed_init.protocol).value())
processed_init.port = String {};
}