1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:07:45 +00:00

AK+Everywhere: Change URL::path() to serialize_path()

This now defaults to serializing the path with percent decoded segments
(which is what all callers expect), but has an option not to. This fixes
`file://` URLs with spaces in their paths.

The name has been changed to serialize_path() path to make it more clear
that this method will generate a new string each call (except for the
cannot_be_a_base_url() case). A few callers have then been updated to
avoid repeatedly calling this function.
This commit is contained in:
MacDue 2023-04-14 20:12:03 +01:00 committed by Andreas Kling
parent 5acd40c525
commit 35612c6a7f
42 changed files with 131 additions and 123 deletions

View file

@ -253,7 +253,7 @@ DeprecatedString CookieJar::default_path(const URL& url)
// https://tools.ietf.org/html/rfc6265#section-5.1.4
// 1. Let uri-path be the path portion of the request-uri if such a portion exists (and empty otherwise).
DeprecatedString uri_path = url.path();
DeprecatedString uri_path = url.serialize_path();
// 2. If the uri-path is empty or if the first character of the uri-path is not a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
if (uri_path.is_empty() || (uri_path[0] != '/'))
@ -376,7 +376,7 @@ Vector<Web::Cookie::Cookie> CookieJar::get_matching_cookies(const URL& url, Depr
return;
// The request-uri's path path-matches the cookie's path.
if (!path_matches(url.path(), cookie.path))
if (!path_matches(url.serialize_path(), cookie.path))
return;
// If the cookie's secure-only-flag is true, then the request-uri's scheme must denote a "secure" protocol.