mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Don't try to complete relative data: URLs
This commit is contained in:
parent
ab4c03ce2d
commit
ec83555b87
Notes:
sideshowbarker
2024-07-19 05:46:57 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ec83555b872
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…
Reference in a new issue