Skip to content

Commit ec83555

Browse files
committed
AK: Don't try to complete relative data: URLs
1 parent ab4c03c commit ec83555

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

AK/URL.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ static inline bool is_digit(char ch)
4747

4848
bool URL::parse(const StringView& string)
4949
{
50+
if (string.is_null())
51+
return false;
52+
5053
enum class State {
5154
InProtocol,
5255
InHostname,
@@ -291,10 +294,16 @@ String URL::to_string() const
291294

292295
URL URL::complete_url(const String& string) const
293296
{
297+
if (!is_valid())
298+
return {};
299+
294300
URL url(string);
295301
if (url.is_valid())
296302
return url;
297303

304+
if (protocol() == "data")
305+
return {};
306+
298307
if (string.starts_with("//")) {
299308
URL url(String::format("%s:%s", m_protocol.characters(), string.characters()));
300309
if (url.is_valid())

0 commit comments

Comments
 (0)