mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:47:44 +00:00
AK: Don't try to complete relative data: URLs
This commit is contained in:
parent
ab4c03ce2d
commit
ec83555b87
1 changed files with 9 additions and 0 deletions
|
@ -47,6 +47,9 @@ static inline bool is_digit(char ch)
|
||||||
|
|
||||||
bool URL::parse(const StringView& string)
|
bool URL::parse(const StringView& string)
|
||||||
{
|
{
|
||||||
|
if (string.is_null())
|
||||||
|
return false;
|
||||||
|
|
||||||
enum class State {
|
enum class State {
|
||||||
InProtocol,
|
InProtocol,
|
||||||
InHostname,
|
InHostname,
|
||||||
|
@ -291,10 +294,16 @@ String URL::to_string() const
|
||||||
|
|
||||||
URL URL::complete_url(const String& string) const
|
URL URL::complete_url(const String& string) const
|
||||||
{
|
{
|
||||||
|
if (!is_valid())
|
||||||
|
return {};
|
||||||
|
|
||||||
URL url(string);
|
URL url(string);
|
||||||
if (url.is_valid())
|
if (url.is_valid())
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
|
if (protocol() == "data")
|
||||||
|
return {};
|
||||||
|
|
||||||
if (string.starts_with("//")) {
|
if (string.starts_with("//")) {
|
||||||
URL url(String::format("%s:%s", m_protocol.characters(), string.characters()));
|
URL url(String::format("%s:%s", m_protocol.characters(), string.characters()));
|
||||||
if (url.is_valid())
|
if (url.is_valid())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue