AK: Remove ApplyPercentDecoding from URL
Nowhere was setting this flag from the default.
This commit is contained in:
parent
98666b012d
commit
db5ad0c2b0
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/db5ad0c2b0 Pull-request: https://github.com/SerenityOS/serenity/pull/20387
2 changed files with 21 additions and 21 deletions
28
AK/URL.cpp
28
AK/URL.cpp
|
@ -36,40 +36,40 @@ URL URL::complete_url(StringView relative_url) const
|
||||||
return URLParser::basic_parse(relative_url, *this);
|
return URLParser::basic_parse(relative_url, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::username(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::username() const
|
||||||
{
|
{
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_username) : m_username;
|
return percent_decode(m_username);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::password(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::password() const
|
||||||
{
|
{
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_password) : m_password;
|
return percent_decode(m_password);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::path_segment_at_index(size_t index, ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::path_segment_at_index(size_t index) const
|
||||||
{
|
{
|
||||||
VERIFY(index < path_segment_count());
|
VERIFY(index < path_segment_count());
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_paths[index]) : m_paths[index];
|
return percent_decode(m_paths[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::basename(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::basename() const
|
||||||
{
|
{
|
||||||
if (!m_valid)
|
if (!m_valid)
|
||||||
return {};
|
return {};
|
||||||
if (m_paths.is_empty())
|
if (m_paths.is_empty())
|
||||||
return {};
|
return {};
|
||||||
auto& last_segment = m_paths.last();
|
auto& last_segment = m_paths.last();
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(last_segment) : last_segment;
|
return percent_decode(last_segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::query(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::query() const
|
||||||
{
|
{
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_query) : m_query;
|
return m_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::fragment(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::fragment() const
|
||||||
{
|
{
|
||||||
return apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(m_fragment) : m_fragment;
|
return percent_decode(m_fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This only exists for compatibility with the existing URL tests which check for both .is_null() and .is_empty().
|
// NOTE: This only exists for compatibility with the existing URL tests which check for both .is_null() and .is_empty().
|
||||||
|
@ -276,14 +276,14 @@ bool URL::is_special_scheme(StringView scheme)
|
||||||
return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss");
|
return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss");
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString URL::serialize_path(ApplyPercentDecoding apply_percent_decoding) const
|
DeprecatedString URL::serialize_path() const
|
||||||
{
|
{
|
||||||
if (cannot_be_a_base_url())
|
if (cannot_be_a_base_url())
|
||||||
return m_paths[0];
|
return m_paths[0];
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (auto& path : m_paths) {
|
for (auto& path : m_paths) {
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
builder.append(apply_percent_decoding == ApplyPercentDecoding::Yes ? percent_decode(path) : path);
|
builder.append(percent_decode(path));
|
||||||
}
|
}
|
||||||
return builder.to_deprecated_string();
|
return builder.to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
14
AK/URL.h
14
AK/URL.h
|
@ -77,15 +77,15 @@ public:
|
||||||
No
|
No
|
||||||
};
|
};
|
||||||
DeprecatedString const& scheme() const { return m_scheme; }
|
DeprecatedString const& scheme() const { return m_scheme; }
|
||||||
DeprecatedString username(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString username() const;
|
||||||
DeprecatedString password(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString password() const;
|
||||||
Host const& host() const { return m_host; }
|
Host const& host() const { return m_host; }
|
||||||
ErrorOr<String> serialized_host() const;
|
ErrorOr<String> serialized_host() const;
|
||||||
DeprecatedString basename(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString basename() const;
|
||||||
DeprecatedString query(ApplyPercentDecoding = ApplyPercentDecoding::No) const;
|
DeprecatedString query() const;
|
||||||
DeprecatedString fragment(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString fragment() const;
|
||||||
Optional<u16> port() const { return m_port; }
|
Optional<u16> port() const { return m_port; }
|
||||||
DeprecatedString path_segment_at_index(size_t index, ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString path_segment_at_index(size_t index) const;
|
||||||
size_t path_segment_count() const { return m_paths.size(); }
|
size_t path_segment_count() const { return m_paths.size(); }
|
||||||
|
|
||||||
u16 port_or_default() const { return m_port.value_or(default_port_for_scheme(m_scheme)); }
|
u16 port_or_default() const { return m_port.value_or(default_port_for_scheme(m_scheme)); }
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
m_paths.append("");
|
m_paths.append("");
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString serialize_path(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const;
|
DeprecatedString serialize_path() const;
|
||||||
DeprecatedString serialize(ExcludeFragment = ExcludeFragment::No) const;
|
DeprecatedString serialize(ExcludeFragment = ExcludeFragment::No) const;
|
||||||
DeprecatedString serialize_for_display() const;
|
DeprecatedString serialize_for_display() const;
|
||||||
DeprecatedString to_deprecated_string() const { return serialize(); }
|
DeprecatedString to_deprecated_string() const { return serialize(); }
|
||||||
|
|
Loading…
Add table
Reference in a new issue